summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2014-10-22 17:14:29 +0200
committerKonstantin Ritt <ritt.ks@gmail.com>2014-12-12 06:59:46 +0100
commit517da68893be9e6d97c7993922c573de9560604d (patch)
tree9da6027604c97023fd6cacc3114c2f2fd43dd26f /src/widgets/styles
parent0478bc15bd3b4c616b4860e460600ba8877ee216 (diff)
Add QFont::Weight enum values
And try to make good use of them in order to match the QFont request more closely. Task-number: QTBUG-38482 Change-Id: I768dfa8828e370d77a1c17ecf4796d750b3edd9b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 61d1cd796e..beb52c01a7 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -57,6 +57,7 @@
#include <private/qgtk2painter_p.h>
#include <private/qapplication_p.h>
#include <private/qiconloader_p.h>
+#include <qpa/qplatformfontdatabase.h>
#include <QtWidgets/QMenu>
#include <QtWidgets/QStyle>
@@ -823,17 +824,8 @@ QFont QGtkStylePrivate::getThemeFont()
if (!family.isEmpty())
font.setFamily(family);
- int weight = pango_font_description_get_weight(gtk_font);
- if (weight >= PANGO_WEIGHT_HEAVY)
- font.setWeight(QFont::Black);
- else if (weight >= PANGO_WEIGHT_BOLD)
- font.setWeight(QFont::Bold);
- else if (weight >= PANGO_WEIGHT_SEMIBOLD)
- font.setWeight(QFont::DemiBold);
- else if (weight >= PANGO_WEIGHT_NORMAL)
- font.setWeight(QFont::Normal);
- else
- font.setWeight(QFont::Light);
+ const int weight = pango_font_description_get_weight(gtk_font);
+ font.setWeight(QPlatformFontDatabase::weightFromInteger(weight));
PangoStyle fontstyle = pango_font_description_get_style(gtk_font);
if (fontstyle == PANGO_STYLE_ITALIC)