summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorJonas Karlsson <jonas.karlsson@qt.io>2020-08-13 16:53:14 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-09-03 17:22:50 +0200
commit0166028af40dce23408aac45f029e681343867e2 (patch)
tree8a04688d895f930122a1cb6657980882314035ed /src/shared
parent0679197952609d4eda827d18d8f586f21decded8 (diff)
downloadqttools-0166028af40dce23408aac45f029e681343867e2.tar.gz
Use OpenType font weights
In Designer, the only way the user can affect the weight of the font is by checking/unchecking "bold", and this is stored as a separate element in the XML. It is undefined which one takes precedence if they do not match (in fact, uic and Designer behaves differently in this case.) To avoid this confusion as well as keep compatibility with old files after we changed the scale of QFont::Weight to match that of OpenType, we just ignore the weight element in the input file. We also stop writing the duplicate information to the file. Task-number: QTBUG-42248 Change-Id: I08682f697a96d764c068e47bdab5d0f45cc2150b Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/fontpanel/fontpanel.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/shared/fontpanel/fontpanel.cpp b/src/shared/fontpanel/fontpanel.cpp
index 45d2a456e..d3c22762a 100644
--- a/src/shared/fontpanel/fontpanel.cpp
+++ b/src/shared/fontpanel/fontpanel.cpp
@@ -105,11 +105,7 @@ QFont FontPanel::selectedFont() const
else
rc.setStyle(QFont::StyleNormal);
rc.setBold(m_fontDatabase.bold(family, styleDescription));
-
- // Weight < 0 asserts...
- const int weight = m_fontDatabase.weight(family, styleDescription);
- if (weight >= 0)
- rc.setWeight(weight);
+ rc.setWeight(QFont::Weight(m_fontDatabase.weight(family, styleDescription)));
return rc;
}