diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-09 13:39:32 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-09 13:14:37 +0000 |
commit | a57564aec2d898e8e1694081c21d30ce4ad91abe (patch) | |
tree | 4e0f1d6ecaa2161dd9432ab0b48112e69e3e3af6 /src/imports | |
parent | 5c5bbfd5b8a313919da3567f003ab412eab606ec (diff) |
Material: fix fonts
Request Roboto or Noto if exists, fallback to the system font. Even if
we fallback to the system font, set the sizes appropriately. The latest
spec for tabs says that the font size 14sp (scaled px) and all caps.
https://www.google.com/design/spec/components/tabs.html#tabs-specs
Change-Id: I34ecadf21306921e2115630ea41771dfef627b48
Task-number: QTBUG-50971
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/controls/material/qquickmaterialtheme.cpp | 14 | ||||
-rw-r--r-- | src/imports/controls/material/qtlabsmaterialstyleplugin.cpp | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp index 75ca1b8f..4124735a 100644 --- a/src/imports/controls/material/qquickmaterialtheme.cpp +++ b/src/imports/controls/material/qquickmaterialtheme.cpp @@ -43,8 +43,18 @@ QT_BEGIN_NAMESPACE QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme) { - systemFont = QFont(QStringLiteral("Roboto")); - tabButtonFont = QFont(QStringLiteral("Roboto"), 10); + QFont font; + font.setFamily(QStringLiteral("Roboto")); + if (!font.exactMatch()) + font.setFamily(QStringLiteral("Noto")); + + if (font.exactMatch()) { + systemFont.setFamily(font.family()); + tabButtonFont.setFamily(font.family()); + } + + tabButtonFont.setPixelSize(14); + tabButtonFont.setCapitalization(QFont::AllUppercase); } QQuickMaterialTheme::~QQuickMaterialTheme() diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp index 2d867308..11df4464 100644 --- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp +++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp @@ -86,12 +86,10 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char QQuickStyleSelector selector; if (selector.style() == QLatin1String("material")) { - if (QFont(QStringLiteral("Roboto")).exactMatch()) { - QPlatformTheme *old = QGuiApplicationPrivate::platform_theme; - if (old) { - QQuickProxyTheme *theme = new QQuickMaterialTheme(old); - QGuiApplicationPrivate::platform_theme = theme; - } + QPlatformTheme *old = QGuiApplicationPrivate::platform_theme; + if (old) { + QQuickProxyTheme *theme = new QQuickMaterialTheme(old); + QGuiApplicationPrivate::platform_theme = theme; } } |