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 Kazakovec72c44887e8
diff --git a/libs/global/KisFileUtils.cpp b/libs/global/KisFileUtils.cppindex 9702b007ca..41bf6dc173 100644--- a/libs/global/KisFileUtils.cpp+++ b/libs/global/KisFileUtils.cpp@@ -10,6 +10,8 @@#include <QFileInfo>#include <QDir>#include <QRegularExpression>+#include <KisPortingUtils.h>+namespace KritaUtils {@@ -51,8 +53,9 @@ QString deduplicateFileName(const QString &fileName,auto match = rex.match(proposedFileName);if (match.hasMatch()) {+ using KisPortingUtils::stringRemoveFirst;baseName = match.captured(1);- completeSuffix = match.captured(2).removeFirst();+ completeSuffix = stringRemoveFirst(match.captured(2));}while (!fileAllowedCallback(proposedFileName)) {diff --git a/libs/global/KisPortingUtils.h b/libs/global/KisPortingUtils.hindex 70665ca5ed..2d5c199497 100644--- a/libs/global/KisPortingUtils.h+++ b/libs/global/KisPortingUtils.h@@ -36,21 +36,21 @@ inline int getScreenNumberForWidget(const QWidget *w)return screens.indexOf(QGuiApplication::primaryScreen());}-inline void stringRemoveLast(QString &str)+inline QString stringRemoveLast(QString str){#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))- str.remove(str.size() - 1, 1);+ return !str.isEmpty() ? str.remove(str.size() - 1, 1) : str;#else- str.removeLast();+ return str.removeLast();#endif}-inline void stringRemoveFirst(QString &str)+inline QString stringRemoveFirst(QString str){#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))- str.remove(0, 1);+ return !str.isEmpty() ? str.remove(0, 1) : str;#else- str.removeFirst();+ return str.removeFirst();#endif}diff --git a/libs/widgets/KoZoomAction.cpp b/libs/widgets/KoZoomAction.cppindex 5ea16c75f5..a91fe8dd9b 100644--- a/libs/widgets/KoZoomAction.cpp+++ b/libs/widgets/KoZoomAction.cpp@@ -83,13 +83,13 @@ void KoZoomAction::slotTextZoomChanged(const QString &value)QString trimmedValue = value.trimmed();if (trimmedValue.endsWith('%')) {- stringRemoveLast(trimmedValue);+ trimmedValue = stringRemoveLast(trimmedValue);} else if (trimmedValue.startsWith('%')) {/*** In Turkish language, the percent sign can go before the* number...*/- stringRemoveFirst(trimmedValue);+ trimmedValue = stringRemoveFirst(trimmedValue);}zoom = QLocale().toDouble(trimmedValue, &isValid);}