diff options
-rw-r--r-- | src/plugins/coreplugin/actionmanager/command.cpp | 1 | ||||
-rw-r--r-- | src/plugins/coreplugin/dialogs/externaltoolconfig.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 11 | ||||
-rw-r--r-- | src/plugins/coreplugin/fancyactionbar.cpp | 8 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index d35bab272c..3e790f9cae 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -33,7 +33,6 @@ #include <utils/stringutils.h> #include <QAction> -#include <QRegExp> #include <QToolButton> #include <QTextStream> diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 02964f4d16..abd87ef73b 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -653,7 +653,7 @@ static QString getUserFilePath(const QString &proposalFileName) static QString idFromDisplayName(const QString &displayName) { QString id = displayName; - id.remove(QRegExp(QLatin1String("&(?!&)"))); + id.remove(QRegularExpression("&(?!&)")); QChar *c = id.data(); while (!c->isNull()) { if (!c->isLetterOrNumber()) diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 1f7d5e6744..d66ff8453c 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -818,14 +818,15 @@ QString DocumentManager::getSaveFileName(const QString &title, const QString &pa // first one from the filter is appended. if (selectedFilter && *selectedFilter != Utils::allFilesFilterString()) { // Mime database creates filter strings like this: Anything here (*.foo *.bar) - QRegExp regExp(QLatin1String(".*\\s+\\((.*)\\)$")); - const int index = regExp.lastIndexIn(*selectedFilter); - if (index != -1) { + const QRegularExpression regExp(QLatin1String(".*\\s+\\((.*)\\)$")); + QRegularExpressionMatchIterator matchIt = regExp.globalMatch(*selectedFilter); + if (matchIt.hasNext()) { bool suffixOk = false; - QString caption = regExp.cap(1); + const QRegularExpressionMatch match = matchIt.next(); + QString caption = match.captured(1); caption.remove(QLatin1Char('*')); const QVector<QStringRef> suffixes = caption.splitRef(QLatin1Char(' ')); - foreach (const QStringRef &suffix, suffixes) + for (const QStringRef &suffix : suffixes) if (fileName.endsWith(suffix)) { suffixOk = true; break; diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 284b68fdae..ed4d5ddb27 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -95,13 +95,15 @@ static QVector<QString> splitInTwoLines(const QString &text, // to put them in the second line. First line is drawn with ellipsis, // second line gets ellipsis if it couldn't split off full words. QVector<QString> splitLines(2); - const QRegExp rx(QLatin1String("\\s+")); + const QRegularExpression rx(QLatin1String("\\s+")); int splitPos = -1; int nextSplitPos = text.length(); do { - nextSplitPos = rx.lastIndexIn(text, nextSplitPos - text.length() - 1); + int offset = nextSplitPos - text.length() - 1; + nextSplitPos = text.lastIndexOf(rx, offset); if (nextSplitPos != -1) { - int splitCandidate = nextSplitPos + rx.matchedLength(); + const QRegularExpressionMatch match = rx.match(text, offset); + int splitCandidate = nextSplitPos + match.capturedLength(); if (fontMetrics.horizontalAdvance(text.mid(splitCandidate)) <= availableWidth) splitPos = splitCandidate; else |