modernize: Use raw string literals instead of escaped strings
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 9 Sep 2018 21:37:56 +0000 (23:37 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
Replace escaped strings with raw string literals in places where
it makes sense, and doesn't confuse lupdate.

17 files changed:
src/client/clientuserinputhandler.cpp
src/client/execwrapper.cpp
src/common/aliasmanager.cpp
src/common/identity.cpp
src/core/coresession.cpp
src/core/coreuserinputhandler.cpp
src/core/ctcpparser.cpp
src/core/ircparser.cpp
src/core/netsplit.cpp
src/core/oidentdconfiggenerator.cpp
src/qtui/chatscene.cpp
src/qtui/qtuistyle.cpp
src/qtui/settingspages/identitiessettingspage.cpp
src/uisupport/clickable.cpp
src/uisupport/contextmenuactionprovider.cpp
src/uisupport/qssparser.cpp
src/uisupport/tabcompleter.cpp

index 573a28a..7179515 100644 (file)
@@ -50,7 +50,7 @@ void ClientUserInputHandler::completionSuffixChanged(const QVariant &v)
 {
     QString suffix = v.toString();
     QString letter = "A-Za-z";
 {
     QString suffix = v.toString();
     QString letter = "A-Za-z";
-    QString special = "\x5b-\x60\x7b-\x7d";
+    QString special = "\x5b-\x60\x7b-\x7d";  // NOLINT(modernize-raw-string-literal)
     _nickRx = QRegExp(QString("^([%1%2][%1%2\\d-]*)%3").arg(letter, special, suffix).trimmed());
 }
 
     _nickRx = QRegExp(QString("^([%1%2][%1%2\\d-]*)%3").arg(letter, special, suffix).trimmed());
 }
 
index 28bffea..8512583 100644 (file)
@@ -44,7 +44,7 @@ void ExecWrapper::start(const BufferInfo &info, const QString &command)
     _bufferInfo = info;
     QString params;
 
     _bufferInfo = info;
     QString params;
 
-    QRegExp rx("^\\s*(\\S+)(\\s+(.*))?$");
+    QRegExp rx(R"(^\s*(\S+)(\s+(.*))?$)");
     if (!rx.exactMatch(command)) {
         emit error(tr("Invalid command string for /exec: %1").arg(command));
     }
     if (!rx.exactMatch(command)) {
         emit error(tr("Invalid command string for /exec: %1").arg(command));
     }
@@ -55,7 +55,7 @@ void ExecWrapper::start(const BufferInfo &info, const QString &command)
 
     // Make sure we don't execute something outside a script dir
     if (_scriptName.contains("../") || _scriptName.contains("..\\"))
 
     // Make sure we don't execute something outside a script dir
     if (_scriptName.contains("../") || _scriptName.contains("..\\"))
-        emit error(tr("Name \"%1\" is invalid: ../ or ..\\ are not allowed!").arg(_scriptName));
+        emit error(tr(R"(Name "%1" is invalid: ../ or ..\ are not allowed!)").arg(_scriptName));
 
     else {
         foreach(QString scriptDir, Quassel::scriptDirPaths()) {
 
     else {
         foreach(QString scriptDir, Quassel::scriptDirPaths()) {
index efb148f..356cd32 100644 (file)
@@ -160,7 +160,7 @@ void AliasManager::expand(const QString &alias, const BufferInfo &bufferInfo, co
         return;
     }
 
         return;
     }
 
-    QRegExp paramRangeR("\\$(\\d+)\\.\\.(\\d*)");
+    QRegExp paramRangeR(R"(\$(\d+)\.\.(\d*))");
     QStringList commands = alias.split(QRegExp("; ?"));
     QStringList params = msg.split(' ');
     QStringList expandedCommands;
     QStringList commands = alias.split(QRegExp("; ?"));
     QStringList params = msg.split(' ');
     QStringList expandedCommands;
index e2cd936..9d885e0 100644 (file)
@@ -135,7 +135,7 @@ QString Identity::defaultNick()
 #endif
 
     // cleaning forbidden characters from nick
 #endif
 
     // cleaning forbidden characters from nick
-    QRegExp rx(QString("(^[\\d-]+|[^A-Za-z0-9\x5b-\x60\x7b-\x7d])"));
+    QRegExp rx(QString("(^[\\d-]+|[^A-Za-z0-9\x5b-\x60\x7b-\x7d])"));  // NOLINT(modernize-raw-string-literal)
     nick.remove(rx);
     return nick;
 }
     nick.remove(rx);
     return nick;
 }
index ab4859b..f2e9671 100644 (file)
@@ -609,7 +609,7 @@ void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &per
     id = info.networkId.toInt();
     if (!_networks.contains(id)) {
         // create persistent chans
     id = info.networkId.toInt();
     if (!_networks.contains(id)) {
         // create persistent chans
-        QRegExp rx("\\s*(\\S+)(?:\\s*(\\S+))?\\s*");
+        QRegExp rx(R"(\s*(\S+)(?:\s*(\S+))?\s*)");
         foreach(QString channel, persistentChans) {
             if (!rx.exactMatch(channel)) {
                 qWarning() << QString("Invalid persistent channel declaration: %1").arg(channel);
         foreach(QString channel, persistentChans) {
             if (!rx.exactMatch(channel)) {
                 qWarning() << QString("Invalid persistent channel declaration: %1").arg(channel);
index d060ada..0b3b2b0 100644 (file)
@@ -144,7 +144,7 @@ void CoreUserInputHandler::banOrUnban(const BufferInfo &bufferInfo, const QStrin
             return;
         }
 
             return;
         }
 
-        static QRegExp ipAddress("\\d+\\.\\d+\\.\\d+\\.\\d+");
+        static QRegExp ipAddress(R"(\d+\.\d+\.\d+\.\d+)");
         if (ipAddress.exactMatch(generalizedHost))    {
             int lastDotPos = generalizedHost.lastIndexOf('.') + 1;
             generalizedHost.replace(lastDotPos, generalizedHost.length() - lastDotPos, '*');
         if (ipAddress.exactMatch(generalizedHost))    {
             int lastDotPos = generalizedHost.lastIndexOf('.') + 1;
             generalizedHost.replace(lastDotPos, generalizedHost.length() - lastDotPos, '*');
index d58d28d..8c43ffb 100644 (file)
@@ -47,7 +47,7 @@ CtcpParser::CtcpParser(CoreSession *coreSession, QObject *parent)
 
 void CtcpParser::setStandardCtcp(bool enabled)
 {
 
 void CtcpParser::setStandardCtcp(bool enabled)
 {
-    QByteArray XQUOTE = QByteArray("\134");
+    QByteArray XQUOTE = QByteArray(R"(\)");
     if (enabled)
         _ctcpXDelimDequoteHash[XQUOTE + XQUOTE] = XQUOTE;
     else
     if (enabled)
         _ctcpXDelimDequoteHash[XQUOTE + XQUOTE] = XQUOTE;
     else
index 5c6fce7..4ffcc5d 100644 (file)
@@ -239,7 +239,7 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e)
                 // :ChanServ!ChanServ@services. NOTICE egst :[#apache] Welcome, this is #apache. Please read the in-channel topic message. This channel is being logged by IRSeekBot. If you have any question please see http://blog.freenode.net/?p=68
                 if (!net->isChannelName(target)) {
                     QString decMsg = net->serverDecode(params.at(1));
                 // :ChanServ!ChanServ@services. NOTICE egst :[#apache] Welcome, this is #apache. Please read the in-channel topic message. This channel is being logged by IRSeekBot. If you have any question please see http://blog.freenode.net/?p=68
                 if (!net->isChannelName(target)) {
                     QString decMsg = net->serverDecode(params.at(1));
-                    QRegExp welcomeRegExp("^\\[([^\\]]+)\\] ");
+                    QRegExp welcomeRegExp(R"(^\[([^\]]+)\] )");
                     if (welcomeRegExp.indexIn(decMsg) != -1) {
                         QString channelname = welcomeRegExp.cap(1);
                         decMsg = decMsg.mid(welcomeRegExp.matchedLength());
                     if (welcomeRegExp.indexIn(decMsg) != -1) {
                         QString channelname = welcomeRegExp.cap(1);
                         decMsg = decMsg.mid(welcomeRegExp.matchedLength());
index 04ab70b..b44c39d 100644 (file)
@@ -117,7 +117,7 @@ bool Netsplit::isNetsplit(const QString &quitMessage)
 
     // now test if message consists only of two dns names as the RFC requests
     // but also allow the commonly used "*.net *.split"
 
     // now test if message consists only of two dns names as the RFC requests
     // but also allow the commonly used "*.net *.split"
-    QRegExp hostRx("^(?:[\\w\\d-.]+|\\*)\\.[\\w\\d-]+\\s(?:[\\w\\d-.]+|\\*)\\.[\\w\\d-]+$");
+    QRegExp hostRx(R"(^(?:[\w\d-.]+|\*)\.[\w\d-]+\s(?:[\w\d-.]+|\*)\.[\w\d-]+$)");
     if (hostRx.exactMatch(quitMessage))
         return true;
 
     if (hostRx.exactMatch(quitMessage))
         return true;
 
index 08b7636..7e75871 100644 (file)
@@ -63,7 +63,7 @@ bool OidentdConfigGenerator::init()
     // the ability to bind to an IP on client sockets.
 
     _quasselStanzaTemplate = QString("lport %1 { reply \"%2\" } #%3\n");
     // the ability to bind to an IP on client sockets.
 
     _quasselStanzaTemplate = QString("lport %1 { reply \"%2\" } #%3\n");
-    _quasselStanzaRx = QRegExp(QString("^lport .* \\{ .* \\} #%1\\r?\\n").arg(_configTag));
+    _quasselStanzaRx = QRegExp(QString(R"(^lport .* \{ .* \} #%1\r?\n)").arg(_configTag));
 
     // initially remove all Quassel stanzas that might be present
     if (parseConfig(false) && writeConfig())
 
     // initially remove all Quassel stanzas that might be present
     if (parseConfig(false) && writeConfig())
index 70c3b64..b2b1a35 100644 (file)
@@ -1392,7 +1392,7 @@ void ChatScene::updateTimestampHasBrackets()
         //   (^\s*\(.+\)\s*$)|(^\s*\{.+\}\s*$)|(^\s*\[.+\]\s*$)|(^\s*<.+>\s*$)
         // Note that '\' must be escaped as '\\'
         // Helpful interactive website for debugging and explaining:  https://regex101.com/
         //   (^\s*\(.+\)\s*$)|(^\s*\{.+\}\s*$)|(^\s*\[.+\]\s*$)|(^\s*<.+>\s*$)
         // Note that '\' must be escaped as '\\'
         // Helpful interactive website for debugging and explaining:  https://regex101.com/
-        const QRegExp regExpMatchBrackets("^\\s*[({[<].+[)}\\]>]\\s*$");
+        const QRegExp regExpMatchBrackets(R"(^\s*[({[<].+[)}\]>]\s*$)");
         _timestampHasBrackets = regExpMatchBrackets.exactMatch(_timestampFormatString);
     }
 }
         _timestampHasBrackets = regExpMatchBrackets.exactMatch(_timestampFormatString);
     }
 }
index fd10e24..efca13a 100644 (file)
@@ -198,7 +198,7 @@ void QtUiStyle::generateSettingsQss() const
         out << "\n// NickView Colors\n"
             << "NickListItem[type=\"category\"] { foreground: " << color("DefaultBuffer", uiColors) << "; }\n"
             << "NickListItem[type=\"user\"] { foreground: " << color("OnlineNick", uiColors) << "; }\n"
         out << "\n// NickView Colors\n"
             << "NickListItem[type=\"category\"] { foreground: " << color("DefaultBuffer", uiColors) << "; }\n"
             << "NickListItem[type=\"user\"] { foreground: " << color("OnlineNick", uiColors) << "; }\n"
-            << "NickListItem[type=\"user\", state=\"away\"] { foreground: " << color("AwayNick", uiColors) << "; }\n";
+            << R"(NickListItem[type="user", state="away"] { foreground: )" << color("AwayNick", uiColors) << "; }\n";
     }
 
     settingsQss.close();
     }
 
     settingsQss.close();
index e2d94f1..0cf9974 100644 (file)
@@ -472,7 +472,7 @@ NickEditDlg::NickEditDlg(const QString &old, QStringList exist, QWidget *parent)
     // define a regexp for valid nicknames
     // TODO: add max nicklength according to ISUPPORT
     QString letter = "A-Za-z";
     // define a regexp for valid nicknames
     // TODO: add max nicklength according to ISUPPORT
     QString letter = "A-Za-z";
-    QString special = "\x5b-\x60\x7b-\x7d";
+    QString special = R"([-`{-})";
     QRegExp rx(QString("[%1%2][%1%2\\d-]*").arg(letter, special));
     ui.nickEdit->setValidator(new QRegExpValidator(rx, ui.nickEdit));
     if (old.isEmpty()) {
     QRegExp rx(QString("[%1%2][%1%2\\d-]*").arg(letter, special));
     ui.nickEdit->setValidator(new QRegExpValidator(rx, ui.nickEdit));
     if (old.isEmpty()) {
index 1f5720e..851e1ca 100644 (file)
@@ -53,10 +53,10 @@ void Clickable::activate(NetworkId networkId, const QString &text) const
 ClickableList ClickableList::fromString(const QString &str)
 {
     // For matching URLs
 ClickableList ClickableList::fromString(const QString &str)
 {
     // For matching URLs
-    static QString scheme("(?:(?:mailto:|(?:[+.-]?\\w)+://)|www(?=\\.\\S+\\.))");
-    static QString authority("(?:(?:[,.;@:]?[-\\w]+)+\\.?|\\[[0-9a-f:.]+\\])(?::\\d+)?");
+    static QString scheme(R"((?:(?:mailto:|(?:[+.-]?\w)+://)|www(?=\.\S+\.)))");
+    static QString authority(R"((?:(?:[,.;@:]?[-\w]+)+\.?|\[[0-9a-f:.]+\])(?::\d+)?)");
     static QString urlChars("(?:[,.;:]*[\\w~@/?&=+$()!%#*-])");
     static QString urlChars("(?:[,.;:]*[\\w~@/?&=+$()!%#*-])");
-    static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)");
+    static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)");  // NOLINT(modernize-raw-string-literal)
 
     static QRegExp regExp[] = {
         // URL
 
     static QRegExp regExp[] = {
         // URL
@@ -65,7 +65,7 @@ ClickableList ClickableList::fromString(const QString &str)
 
         // Channel name
         // We don't match for channel names starting with + or &, because that gives us a lot of false positives.
 
         // Channel name
         // We don't match for channel names starting with + or &, because that gives us a lot of false positives.
-        QRegExp("((?:#|![A-Z0-9]{5})[^,:\\s]+(?::[^,:\\s]+)?)\\b", Qt::CaseInsensitive)
+        QRegExp(R"(((?:#|![A-Z0-9]{5})[^,:\s]+(?::[^,:\s]+)?)\b)", Qt::CaseInsensitive)
 
         // TODO: Nicks, we'll need a filtering for only matching known nicknames further down if we do this
     };
 
         // TODO: Nicks, we'll need a filtering for only matching known nicknames further down if we do this
     };
index 79c9d19..3bc7cd0 100644 (file)
@@ -458,7 +458,7 @@ void ContextMenuActionProvider::addIgnoreMenu(QMenu *menu, const QString &hostma
     QString ident = userFromMask(hostmask);
     QString host = hostFromMask(hostmask);
     QString domain = host;
     QString ident = userFromMask(hostmask);
     QString host = hostFromMask(hostmask);
     QString domain = host;
-    QRegExp domainRx = QRegExp("(\\.[^.]+\\.\\w+\\D)$");
+    QRegExp domainRx = QRegExp(R"((\.[^.]+\.\w+\D)$)");
     if (domainRx.indexIn(host) != -1)
         domain = domainRx.cap(1);
     // we can't rely on who-data
     if (domainRx.indexIn(host) != -1)
         domain = domainRx.cap(1);
     // we can't rely on who-data
index 61679d9..495adc5 100644 (file)
@@ -82,7 +82,7 @@ void QssParser::processStyleSheet(QString &ss)
         return;
 
     // Remove C-style comments /* */ or //
         return;
 
     // Remove C-style comments /* */ or //
-    static QRegExp commentRx("(//.*(\\n|$)|/\\*.*\\*/)");
+    static QRegExp commentRx(R"((//.*(\n|$)|/\*.*\*/))");
     commentRx.setMinimal(true);
     ss.remove(commentRx);
 
     commentRx.setMinimal(true);
     ss.remove(commentRx);
 
@@ -200,7 +200,7 @@ std::pair<UiStyle::FormatType, UiStyle::MessageLabel> QssParser::parseFormatType
 
     const std::pair<UiStyle::FormatType, UiStyle::MessageLabel> invalid{FormatType::Invalid, MessageLabel::None};
 
 
     const std::pair<UiStyle::FormatType, UiStyle::MessageLabel> invalid{FormatType::Invalid, MessageLabel::None};
 
-    static const QRegExp rx("ChatLine(?:::(\\w+))?(?:#([\\w\\-]+))?(?:\\[([=-,\\\"\\w\\s]+)\\])?");
+    static const QRegExp rx(R"(ChatLine(?:::(\w+))?(?:#([\w\-]+))?(?:\[([=-,\"\w\s]+)\])?)");
     // $1: subelement; $2: msgtype; $3: conditionals
     if (!rx.exactMatch(decl)) {
         qWarning() << Q_FUNC_INFO << tr("Invalid block declaration: %1").arg(decl);
     // $1: subelement; $2: msgtype; $3: conditionals
     if (!rx.exactMatch(decl)) {
         qWarning() << Q_FUNC_INFO << tr("Invalid block declaration: %1").arg(decl);
@@ -279,7 +279,7 @@ std::pair<UiStyle::FormatType, UiStyle::MessageLabel> QssParser::parseFormatType
     }
 
     // Next up: conditional (formats, labels, nickhash)
     }
 
     // Next up: conditional (formats, labels, nickhash)
-    static const QRegExp condRx("\\s*([\\w\\-]+)\\s*=\\s*\"(\\w+)\"\\s*");
+    static const QRegExp condRx(R"lit(\s*([\w\-]+)\s*=\s*"(\w+)"\s*)lit");
     if (!conditions.isEmpty()) {
         foreach(const QString &cond, conditions.split(',', QString::SkipEmptyParts)) {
             if (!condRx.exactMatch(cond)) {
     if (!conditions.isEmpty()) {
         foreach(const QString &cond, conditions.split(',', QString::SkipEmptyParts)) {
             if (!condRx.exactMatch(cond)) {
@@ -359,7 +359,7 @@ UiStyle::ItemFormatType QssParser::parseItemFormatType(const QString &decl)
 {
     using ItemFormatType = UiStyle::ItemFormatType;
 
 {
     using ItemFormatType = UiStyle::ItemFormatType;
 
-    static const QRegExp rx("(Chat|Nick)ListItem(?:\\[([=-,\\\"\\w\\s]+)\\])?");
+    static const QRegExp rx(R"((Chat|Nick)ListItem(?:\[([=-,\"\w\s]+)\])?)");
     // $1: item type; $2: properties
     if (!rx.exactMatch(decl)) {
         qWarning() << Q_FUNC_INFO << tr("Invalid block declaration: %1").arg(decl);
     // $1: item type; $2: properties
     if (!rx.exactMatch(decl)) {
         qWarning() << Q_FUNC_INFO << tr("Invalid block declaration: %1").arg(decl);
@@ -374,7 +374,7 @@ UiStyle::ItemFormatType QssParser::parseItemFormatType(const QString &decl)
     QString type, state;
     if (!properties.isEmpty()) {
         QHash<QString, QString> props;
     QString type, state;
     if (!properties.isEmpty()) {
         QHash<QString, QString> props;
-        static const QRegExp propRx("\\s*([\\w\\-]+)\\s*=\\s*\"([\\w\\-]+)\"\\s*");
+        static const QRegExp propRx(R"lit(\s*([\w\-]+)\s*=\s*"([\w\-]+)"\s*)lit");
         foreach(const QString &prop, properties.split(',', QString::SkipEmptyParts)) {
             if (!propRx.exactMatch(prop)) {
                 qWarning() << Q_FUNC_INFO << tr("Invalid proplist %1").arg(prop);
         foreach(const QString &prop, properties.split(',', QString::SkipEmptyParts)) {
             if (!propRx.exactMatch(prop)) {
                 qWarning() << Q_FUNC_INFO << tr("Invalid proplist %1").arg(prop);
@@ -539,7 +539,7 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok)
         //   [0-9]     Match any digit from 0-9
         // Note that '\' must be escaped as '\\'
         // Helpful interactive website for debugging and explaining:  https://regex101.com/
         //   [0-9]     Match any digit from 0-9
         // Note that '\' must be escaped as '\\'
         // Helpful interactive website for debugging and explaining:  https://regex101.com/
-        static const QRegExp rx("palette\\s*\\(\\s*([a-z-0-9]+)\\s*\\)");
+        static const QRegExp rx(R"(palette\s*\(\s*([a-z-0-9]+)\s*\))");
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid palette color role specification: %1").arg(str);
             return QBrush();
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid palette color role specification: %1").arg(str);
             return QBrush();
@@ -552,8 +552,8 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok)
         return QBrush();
     }
     else if (str.startsWith("qlineargradient")) {
         return QBrush();
     }
     else if (str.startsWith("qlineargradient")) {
-        static const QString rxFloat("\\s*(-?\\s*[0-9]*\\.?[0-9]+)\\s*");
-        static const QRegExp rx(QString("qlineargradient\\s*\\(\\s*x1:%1,\\s*y1:%1,\\s*x2:%1,\\s*y2:%1,(.+)\\)").arg(rxFloat));
+        static const QString rxFloat(R"(\s*(-?\s*[0-9]*\.?[0-9]+)\s*)");
+        static const QRegExp rx(QString(R"(qlineargradient\s*\(\s*x1:%1,\s*y1:%1,\s*x2:%1,\s*y2:%1,(.+)\))").arg(rxFloat));
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
@@ -575,8 +575,8 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok)
         return QBrush(gradient);
     }
     else if (str.startsWith("qconicalgradient")) {
         return QBrush(gradient);
     }
     else if (str.startsWith("qconicalgradient")) {
-        static const QString rxFloat("\\s*(-?\\s*[0-9]*\\.?[0-9]+)\\s*");
-        static const QRegExp rx(QString("qconicalgradient\\s*\\(\\s*cx:%1,\\s*cy:%1,\\s*angle:%1,(.+)\\)").arg(rxFloat));
+        static const QString rxFloat(R"(\s*(-?\s*[0-9]*\.?[0-9]+)\s*)");
+        static const QRegExp rx(QString(R"(qconicalgradient\s*\(\s*cx:%1,\s*cy:%1,\s*angle:%1,(.+)\))").arg(rxFloat));
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
@@ -597,8 +597,8 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok)
         return QBrush(gradient);
     }
     else if (str.startsWith("qradialgradient")) {
         return QBrush(gradient);
     }
     else if (str.startsWith("qradialgradient")) {
-        static const QString rxFloat("\\s*(-?\\s*[0-9]*\\.?[0-9]+)\\s*");
-        static const QRegExp rx(QString("qradialgradient\\s*\\(\\s*cx:%1,\\s*cy:%1,\\s*radius:%1,\\s*fx:%1,\\s*fy:%1,(.+)\\)").arg(rxFloat));
+        static const QString rxFloat(R"(\s*(-?\s*[0-9]*\.?[0-9]+)\s*)");
+        static const QRegExp rx(QString(R"(qradialgradient\s*\(\s*cx:%1,\s*cy:%1,\s*radius:%1,\s*fx:%1,\s*fy:%1,(.+)\))").arg(rxFloat));
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
         if (!rx.exactMatch(str)) {
             qWarning() << Q_FUNC_INFO << tr("Invalid gradient declaration: %1").arg(str);
             return QBrush();
@@ -666,7 +666,7 @@ QColor QssParser::parseColor(const QString &str)
 QssParser::ColorTuple QssParser::parseColorTuple(const QString &str)
 {
     ColorTuple result;
 QssParser::ColorTuple QssParser::parseColorTuple(const QString &str)
 {
     ColorTuple result;
-    static const QRegExp rx("\\(((\\s*[0-9]{1,3}%?\\s*)(,\\s*[0-9]{1,3}%?\\s*)*)\\)");
+    static const QRegExp rx(R"(\(((\s*[0-9]{1,3}%?\s*)(,\s*[0-9]{1,3}%?\s*)*)\))");
     if (!rx.exactMatch(str.trimmed())) {
         return ColorTuple();
     }
     if (!rx.exactMatch(str.trimmed())) {
         return ColorTuple();
     }
@@ -696,7 +696,7 @@ QGradientStops QssParser::parseGradientStops(const QString &str_)
     QString str = str_;
     QGradientStops result;
     static const QString rxFloat("(0?\\.[0-9]+|[01])"); // values between 0 and 1
     QString str = str_;
     QGradientStops result;
     static const QString rxFloat("(0?\\.[0-9]+|[01])"); // values between 0 and 1
-    static const QRegExp rx(QString("\\s*,?\\s*stop:\\s*(%1)\\s+([^:]+)(,\\s*stop:|$)").arg(rxFloat));
+    static const QRegExp rx(QString(R"(\s*,?\s*stop:\s*(%1)\s+([^:]+)(,\s*stop:|$))").arg(rxFloat));
     int idx;
     while ((idx = rx.indexIn(str)) == 0) {
         qreal x = rx.cap(1).toDouble();
     int idx;
     while ((idx = rx.indexIn(str)) == 0) {
         qreal x = rx.cap(1).toDouble();
index 957ddb0..ae37fd9 100644 (file)
@@ -80,8 +80,8 @@ void TabCompleter::buildCompletionList()
     if (!_currentNetwork)
         return;
 
     if (!_currentNetwork)
         return;
 
-    QString tabAbbrev = _lineEdit->text().left(_lineEdit->cursorPosition()).section(QRegExp("[^#\\w\\d-_\\[\\]{}|`^.\\\\]"), -1, -1);
-    QRegExp regex(QString("^[-_\\[\\]{}|`^.\\\\]*").append(QRegExp::escape(tabAbbrev)), Qt::CaseInsensitive);
+    QString tabAbbrev = _lineEdit->text().left(_lineEdit->cursorPosition()).section(QRegExp(R"([^#\w\d-_\[\]{}|`^.\\])"), -1, -1);
+    QRegExp regex(QString(R"(^[-_\[\]{}|`^.\\]*)").append(QRegExp::escape(tabAbbrev)), Qt::CaseInsensitive);
 
     // channel completion - add all channels of the current network to the map
     if (tabAbbrev.startsWith('#')) {
 
     // channel completion - add all channels of the current network to the map
     if (tabAbbrev.startsWith('#')) {