Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Fix build on Qt5
Dmitry Kazakov7eb672baa7cc
diff --git a/libs/flake/KoZoomMode.cpp b/libs/flake/KoZoomMode.cppindex b2e8441827..89ee594878 100644--- a/libs/flake/KoZoomMode.cpp+++ b/libs/flake/KoZoomMode.cpp@@ -6,10 +6,15 @@*/#include "KoZoomMode.h"++#include <QDebug>+#include <klocalizedstring.h>#include <kconfiggroup.h>#include <ksharedconfig.h>+#include <cmath>+const char* const KoZoomMode::modes[] ={QT_TRANSLATE_NOOP("", "%1%"),diff --git a/libs/flake/KoZoomMode.h b/libs/flake/KoZoomMode.hindex b58de88a21..5e78a8c64e 100644--- a/libs/flake/KoZoomMode.h+++ b/libs/flake/KoZoomMode.h@@ -11,6 +11,8 @@#include <QFlags>#include "kritaflake_export.h"+class QDebug;+/*** The ZoomMode container*/diff --git a/libs/global/KisPortingUtils.h b/libs/global/KisPortingUtils.hindex 44312e7119..70665ca5ed 100644--- a/libs/global/KisPortingUtils.h+++ b/libs/global/KisPortingUtils.h@@ -36,7 +36,29 @@ inline int getScreenNumberForWidget(const QWidget *w)return screens.indexOf(QGuiApplication::primaryScreen());}+inline void stringRemoveLast(QString &str)+{+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))+ str.remove(str.size() - 1, 1);+#else+ str.removeLast();+#endif}+inline void stringRemoveFirst(QString &str)+{+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))+ str.remove(0, 1);+#else+ str.removeFirst();+#endif+}++}++#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))+#define Q_UNREACHABLE_RETURN(...) Q_UNREACHABLE(); return __VA_ARGS__+#endif+#endif // KISPORTINGUTILS_Hdiff --git a/libs/ui/canvas/kis_coordinates_converter.cpp b/libs/ui/canvas/kis_coordinates_converter.cppindex 12cefd6e95..fdd7a980d4 100644--- a/libs/ui/canvas/kis_coordinates_converter.cpp+++ b/libs/ui/canvas/kis_coordinates_converter.cpp@@ -18,6 +18,7 @@#include <kis_algebra_2d.h>#include <kis_assert.h>#include <KisValueCache.h>+#include <KisPortingUtils.h>struct KisCoordinatesConverter::Private {diff --git a/libs/widgets/KoZoomAction.cpp b/libs/widgets/KoZoomAction.cppindex 3724381c76..e44cbb3054 100644--- a/libs/widgets/KoZoomAction.cpp+++ b/libs/widgets/KoZoomAction.cpp@@ -21,6 +21,7 @@#include <klocalizedstring.h>#include <kis_signal_compressor.h>#include <KoZoomActionState.h>+#include <KisPortingUtils.h>class Q_DECL_HIDDEN KoZoomAction::Private{@@ -77,15 +78,18 @@ void KoZoomAction::slotTextZoomChanged(const QString &value)qreal zoom = QLocale().toDouble(value, &isValid);if (!isValid) {+ using KisPortingUtils::stringRemoveFirst;+ using KisPortingUtils::stringRemoveLast;+QString trimmedValue = value.trimmed();if (trimmedValue.endsWith('%')) {- trimmedValue.removeLast();+ stringRemoveLast(trimmedValue);} else if (trimmedValue.startsWith('%')) {/*** In Turkish language, the percent sign can go before the* number...*/- trimmedValue.removeFirst();+ stringRemoveFirst(trimmedValue);}zoom = QLocale().toDouble(trimmedValue, &isValid);}diff --git a/libs/widgets/KoZoomActionState.cpp b/libs/widgets/KoZoomActionState.cppindex 7a99dc57c4..c24d8ea7cd 100644--- a/libs/widgets/KoZoomActionState.cpp+++ b/libs/widgets/KoZoomActionState.cpp@@ -6,6 +6,7 @@#include "KoZoomActionState.h"+#include <QDebug>#include <QLocale>#include <klocalizedstring.h>@@ -31,12 +32,12 @@ QVector<KoZoomActionState::ZoomItem> generateZoomGuiItems(const QVector<qreal> &QVector<KoZoomActionState::ZoomItem> result;result.reserve(zoomLevels.size() + 3);- result.emplace_back(KoZoomMode::ZOOM_PAGE, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_PAGE));- result.emplace_back(KoZoomMode::ZOOM_WIDTH, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_WIDTH));- result.emplace_back(KoZoomMode::ZOOM_HEIGHT, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_HEIGHT));+ result.push_back(KoZoomActionState::ZoomItem{KoZoomMode::ZOOM_PAGE, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_PAGE)});+ result.push_back(KoZoomActionState::ZoomItem{KoZoomMode::ZOOM_WIDTH, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_WIDTH)});+ result.push_back(KoZoomActionState::ZoomItem{KoZoomMode::ZOOM_HEIGHT, -1.0, KoZoomMode::toString(KoZoomMode::ZOOM_HEIGHT)});Q_FOREACH (qreal value, zoomLevels) {- result.emplace_back(KoZoomMode::ZOOM_CONSTANT, value, zoomToString(value));+ result.push_back(KoZoomActionState::ZoomItem{KoZoomMode::ZOOM_CONSTANT, value, zoomToString(value)});}return result;