summaryrefslogtreecommitdiffstats
path: root/src/designer/src/lib/shared/rcc.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-03-18 22:07:41 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-03-19 11:03:11 +0100
commitdb14f7047ba45cff42adb73eac0bce4034dd4a03 (patch)
treebb0c66df445cf389e63098f2ba7a603c03e0ed7c /src/designer/src/lib/shared/rcc.cpp
parentaa1cdb8a6138501aa76e7d208afac6598dad27a6 (diff)
Migrate away from QRegExp
It will be moved to Qt5Compat, avoid depending on it where not necessary. Remove usages in Qt Designer, windeployqt and examples. Change-Id: I5f5efc6999e60d995ebbc81fcaf80e7be08711b2 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/designer/src/lib/shared/rcc.cpp')
-rw-r--r--src/designer/src/lib/shared/rcc.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/designer/src/lib/shared/rcc.cpp b/src/designer/src/lib/shared/rcc.cpp
index 050c6f418..6d271bd8a 100644
--- a/src/designer/src/lib/shared/rcc.cpp
+++ b/src/designer/src/lib/shared/rcc.cpp
@@ -38,7 +38,6 @@
#include <QtCore/qfile.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qlocale.h>
-#include <QtCore/qregexp.h>
#include <QtCore/qstack.h>
#include <QtCore/qxmlstream.h>
@@ -951,6 +950,16 @@ void RCCResourceLibrary::writeAddNamespaceFunction(const QByteArray &name)
}
}
+static bool unacceptableChar(QChar qc)
+{
+ if (qc.isDigit())
+ return false;
+ if (!qc.isLetter())
+ return true;
+ auto c = qc.toLower().toLatin1();
+ return c < 'a' || c > 'z';
+}
+
bool RCCResourceLibrary::writeInitializer()
{
if (m_format == C_Code) {
@@ -958,7 +967,8 @@ bool RCCResourceLibrary::writeInitializer()
QString initName = m_initName;
if (!initName.isEmpty()) {
initName.prepend(QLatin1Char('_'));
- initName.replace(QRegExp(QLatin1String("[^a-zA-Z0-9_]")), QLatin1String("_"));
+ std::replace_if(initName.begin(), initName.end(),
+ unacceptableChar, QLatin1Char('_'));
}
//init