diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-09 13:45:04 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-09 13:14:39 +0000 |
commit | 405c3a16169dae95864ed074d4dd4e344d143497 (patch) | |
tree | f62ee4b87bca7eb3ebbf204d383ee4072a1e9923 /src/imports | |
parent | a57564aec2d898e8e1694081c21d30ce4ad91abe (diff) |
Universal: fix fonts
Request Segoe if exists, fallback to the system font. Even if we
fallback to the system font, set the sizes and weights appropriately.
Change-Id: I6cd34efcb5e41171758ffb2fbab22dc9d52c95a4
Task-number: QTBUG-50971
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/controls/universal/qquickuniversaltheme.cpp | 13 | ||||
-rw-r--r-- | src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp | 10 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp index e3899d53..290faa5d 100644 --- a/src/imports/controls/universal/qquickuniversaltheme.cpp +++ b/src/imports/controls/universal/qquickuniversaltheme.cpp @@ -43,11 +43,18 @@ QT_BEGIN_NAMESPACE QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme) { - systemFont = QFont(QStringLiteral("Segoe UI")); + const QFont font(QStringLiteral("Segoe UI")); + if (font.exactMatch()) { + systemFont.setFamily(font.family()); + groupBoxTitleFont.setFamily(font.family()); + tabButtonFont.setFamily(font.family()); + } + systemFont.setPixelSize(15); - groupBoxTitleFont = systemFont; + + groupBoxTitleFont.setPixelSize(15); groupBoxTitleFont.setWeight(QFont::DemiBold); - tabButtonFont = QFont(QStringLiteral("Segoe UI")); + tabButtonFont.setPixelSize(24); tabButtonFont.setWeight(QFont::Light); } diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp index 6f215d75..b3a82781 100644 --- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp +++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp @@ -84,12 +84,10 @@ void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char { QQuickStyleSelector selector; if (selector.style() == QLatin1String("universal")) { - if (QFont(QStringLiteral("Segoe UI")).exactMatch()) { - QPlatformTheme *old = QGuiApplicationPrivate::platform_theme; - if (old) { - QQuickProxyTheme *theme = new QQuickUniversalTheme(old); - QGuiApplicationPrivate::platform_theme = theme; - } + QPlatformTheme *old = QGuiApplicationPrivate::platform_theme; + if (old) { + QQuickProxyTheme *theme = new QQuickUniversalTheme(old); + QGuiApplicationPrivate::platform_theme = theme; } } |