From: Shane Synan Date: Fri, 2 Dec 2016 21:50:38 +0000 (-0600) Subject: Allow palette names with digits 0-9 X-Git-Tag: travis-deploy-test~326 X-Git-Url: https://git.quassel-irc.org/?a=commitdiff_plain;h=a04eac3ffa53cb9eea9ebc46ea67a958f0269220;p=quassel.git Allow palette names with digits 0-9 Modify the regular expression for palette matching to allow digits (e.g. 0-9) in the name. There seems to be no reason to block them. Document the palette-matching regex. --- diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index 78dc4162..30a8fdd9 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -463,7 +463,21 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok) } if (str.startsWith("palette")) { // Palette color role - QRegExp rx("palette\\s*\\(\\s*([a-z-]+)\\s*\\)"); + // Does the palette follow the expected format? For example: + // palette(marker-line) + // palette ( system-color-0f ) + // + // Match the palette marker, grabbing the name inside in case-sensitive manner + // palette\s*\(\s*([a-z-0-9]+)\s*\) + // palette Match the string 'palette' + // \s* Match any amount of whitespace + // \(, \) Match literal '(' or ')' marks + // (...+) Match contents between 1 and unlimited number of times + // [a-z-] Match any character from a-z, case sensitive + // [0-9] Match any digit from 0-9 + // Note that '\' must be escaped as '\\' + // Helpful interactive website for debugging and explaining: https://regex101.com/ + QRegExp rx("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();