From 014e8f47c58a316b78cfa8960d0791546b3cd872 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 19 Jul 2018 23:00:52 +0200 Subject: [PATCH] QssParser: Don't interpret `font: normal` as weight 0 It fell through to the unchecked int conversion. Also handle "strikethrough" and don't forget to reset the underline style. --- src/uisupport/qssparser.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index 166648f1..ff47c05f 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -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); -- 2.20.1