QssParser: Don't interpret `font: normal` as weight 0
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Thu, 19 Jul 2018 21:00:52 +0000 (23:00 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 24 Jul 2018 21:03:17 +0000 (23:03 +0200)
It fell through to the unchecked int conversion.

Also handle "strikethrough" and don't forget to reset the underline
style.

src/uisupport/qssparser.cpp

index 166648f..ff47c05 100644 (file)
@@ -721,13 +721,19 @@ void QssParser::parseFont(const QString &value, QTextCharFormat *format)
         return;
     }
     format->setFontItalic(false);
+    format->setFontUnderline(false);
+    format->setFontStrikeOut(false);
     format->setFontWeight(QFont::Normal);
     QStringList proplist = rx.cap(1).split(' ', QString::SkipEmptyParts);
     foreach(QString prop, proplist) {
-        if (prop == "italic")
+        if (prop == "normal")
+            ; // pass
+        else if (prop == "italic")
             format->setFontItalic(true);
         else if (prop == "underline")
             format->setFontUnderline(true);
+        else if (prop == "strikethrough")
+            format->setFontStrikeOut(true);
         else if(prop == "oblique")
             // Oblique is not a property supported by QTextCharFormat
             format->setFontItalic(true);