summaryrefslogtreecommitdiffstats
path: root/src/windeployqt/main.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/windeployqt/main.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/windeployqt/main.cpp')
-rw-r--r--src/windeployqt/main.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp
index 4a50959b5..ed1a81a77 100644
--- a/src/windeployqt/main.cpp
+++ b/src/windeployqt/main.cpp
@@ -49,6 +49,7 @@
#include <algorithm>
#include <iostream>
+#include <iterator>
#include <cstdio>
QT_BEGIN_NAMESPACE
@@ -1225,6 +1226,16 @@ static bool updateLibrary(const QString &sourceFileName, const QString &targetDi
return true;
}
+// Find out the ICU version to add the data library icudtXX.dll, which does not
+// show as a dependency.
+static QString getIcuVersion(const QString &libName)
+{
+ QString version;
+ std::copy_if(libName.cbegin(), libName.cend(), std::back_inserter(version),
+ [](QChar c) { return c.isDigit(); });
+ return version;
+}
+
static DeployResult deploy(const Options &options,
const QMap<QString, QString> &qmakeVariables,
QString *errorMessage)
@@ -1317,11 +1328,8 @@ static DeployResult deploy(const Options &options,
if (!icuLibs.isEmpty()) {
// Find out the ICU version to add the data library icudtXX.dll, which does not show
// as a dependency.
- QRegExp numberExpression(QStringLiteral("\\d+"));
- Q_ASSERT(numberExpression.isValid());
- const int index = numberExpression.indexIn(icuLibs.front());
- if (index >= 0) {
- const QString icuVersion = icuLibs.front().mid(index, numberExpression.matchedLength());
+ const QString icuVersion = getIcuVersion(icuLibs.constFirst());
+ if (!icuVersion.isEmpty()) {
if (optVerboseLevel > 1)
std::wcout << "Adding ICU version " << icuVersion << '\n';
icuLibs.push_back(QStringLiteral("icudt") + icuVersion + QLatin1String(windowsSharedLibrarySuffix));