summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-05-05 02:17:56 -0700
committerJake Petroules <jake.petroules@qt.io>2016-06-01 02:29:51 +0000
commita160bd4fccaebafb5453a642f43bdefafc1e2565 (patch)
tree3e71ff16f36f49a739c724ec1d4f49ab8fa545ff /src/gui/text/qtextformat.cpp
parentbb30da895eca5a80265317db1fc7a0d151005e30 (diff)
Fix bugs causing Thin font weights to be ignored or mishandled.
Task-number: QTBUG-53196 Change-Id: If12b3cab3d8de5e0e452fca844b0a484c29e9e86 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text/qtextformat.cpp')
-rw-r--r--src/gui/text/qtextformat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 7dcd060ba1..4b31b49df2 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -357,9 +357,10 @@ void QTextFormatPrivate::recalcFont() const
f.setPixelSize(props.at(i).value.toInt());
break;
case QTextFormat::FontWeight: {
- int weight = props.at(i).value.toInt();
- if (weight == 0) weight = QFont::Normal;
- f.setWeight(weight);
+ const QVariant weightValue = props.at(i).value;
+ int weight = weightValue.toInt();
+ if (weight >= 0 && weightValue.isValid())
+ f.setWeight(weight);
break; }
case QTextFormat::FontItalic:
f.setItalic(props.at(i).value.toBool());