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

Qt6: explcitly include QRegExp

Halla Rempt2c323755c115
diff --git a/libs/flake/svg/SvgCssHelper.cpp b/libs/flake/svg/SvgCssHelper.cpp
index 509535a982..c1848357b7 100644
--- a/libs/flake/svg/SvgCssHelper.cpp
+++ b/libs/flake/svg/SvgCssHelper.cpp
@@ -7,6 +7,7 @@
#include "SvgCssHelper.h"
#include <FlakeDebug.h>
#include <QPair>
+#include <QRegExp>
/// Token types used for tokenizing complex selectors
enum CssTokenType {
@@ -633,7 +634,11 @@ void SvgCssHelper::parseStylesheet(const QDomElement &e)
// remove comments
QRegExp commentExp("\\/\\*.*\\*\\/");
commentExp.setMinimal(true); // do not match greedy
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
data.remove(commentExp);
+#else
+ commentExp.removeIn(data);
+#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QStringList defs = data.split('}', Qt::SkipEmptyParts);
diff --git a/libs/flake/text/KoSvgTextProperties.cpp b/libs/flake/text/KoSvgTextProperties.cpp
index 886bc7e8e0..751aca91bd 100644
--- a/libs/flake/text/KoSvgTextProperties.cpp
+++ b/libs/flake/text/KoSvgTextProperties.cpp
@@ -9,6 +9,8 @@
#include <QFontMetrics>
#include <QGlobalStatic>
#include <QMap>
+#include <QRegExp>
+
#include <fontconfig/fontconfig.h>
#include <SvgGraphicContext.h>
@@ -254,12 +256,15 @@ void KoSvgTextProperties::parseSvgTextAttribute(const SvgLoadingContext &context
}
} else if (command == "vertical-align") {
QRegExp digits = QRegExp("\\d");
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
Q_FOREACH (const QString &param, value.split(' ', Qt::SkipEmptyParts)) {
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+ bool paramContains = param.contains(digits);
#else
- Q_FOREACH (const QString &param, value.split(' ', QString::SkipEmptyParts)) {
+ bool paramContains = (digits.indexIn(param) > 0);
#endif
- if (param == "sub" || param == "super" || param.contains(digits)) {
+
+
+ if (param == "sub" || param == "super" || paramContains) {
parseSvgTextAttribute(context, "baseline-shift", param);
} else {
parseSvgTextAttribute(context, "alignment-baseline", param);