Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Port using QRegExp on a QString

Halla Rempt9e02a449792c
diff --git a/libs/pigment/KoColor.cpp b/libs/pigment/KoColor.cpp
index ee195970ab..f8ca4eb671 100644
--- a/libs/pigment/KoColor.cpp
+++ b/libs/pigment/KoColor.cpp
@@ -490,8 +490,12 @@ QString KoColor::toSVG11(QHash<QString, const KoColorProfile *> *profileList) co
QString csName = colorSpace()->profile()->name();
// remove forbidden characters
// https://www.w3.org/TR/SVG11/types.html#DataTypeName
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
csName.remove(QRegExp("[\\(\\),\\s]"));
-
+#else
+ QRegExp reg("[\\(\\),\\s]");
+ reg.removeIn(csName);
+#endif
//reuse existing name if possible. We're looking for the color profile, because svg doesn't care about depth.
csName = profileList->key(colorSpace()->profile(), csName);
diff --git a/libs/ui/input/kis_input_profile_manager.cpp b/libs/ui/input/kis_input_profile_manager.cpp
index c0b437b84c..63ceab3951 100644
--- a/libs/ui/input/kis_input_profile_manager.cpp
+++ b/libs/ui/input/kis_input_profile_manager.cpp
@@ -12,6 +12,7 @@
#include <QStringList>
#include <QDir>
#include <QGlobalStatic>
+#include <QRegExp>
#include <KoResourcePaths.h>
#include <kconfig.h>
@@ -452,5 +453,13 @@ void KisInputProfileManager::Private::createActions()
QString KisInputProfileManager::Private::profileFileName(const QString &profileName)
{
- return profileName.toLower().remove(QRegExp("[^a-z0-9]")).append(".profile");
+ QRegExp reg("[^a-z0-9]");
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+ return profileName.toLower().remove(QRegExp("[^a-z0-9]")).append(".profile");
+#else
+ QString pf = profileName.toLower();
+ reg.removeIn(pf);
+ return pf.append(".profile");
+#endif
+
}