aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/qquickmaterialtheme.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/material/qquickmaterialtheme.cpp')
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 5c89d382..1967a74b 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -37,6 +37,7 @@
#include "qquickmaterialtheme_p.h"
#include <QtGui/qfont.h>
+#include <QtGui/qfontinfo.h>
QT_BEGIN_NAMESPACE
@@ -44,15 +45,22 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
QFont font;
- font.setFamily(QStringLiteral("Roboto"));
- if (!font.exactMatch())
- font.setFamily(QStringLiteral("Noto"));
+ font.setFamily(QLatin1String("Roboto"));
+ QString family = QFontInfo(font).family();
- if (font.exactMatch()) {
- systemFont.setFamily(font.family());
- buttonFont.setFamily(font.family());
- itemViewFont.setFamily(font.family());
- menuItemFont.setFamily(font.family());
+ if (family != QLatin1String("Roboto")) {
+ font.setFamily(QLatin1String("Noto"));
+ family = QFontInfo(font).family();
+ }
+
+ if (family == QLatin1String("Roboto") || family == QLatin1String("Noto")) {
+ systemFont.setFamily(family);
+ buttonFont.setFamily(family);
+ toolTipFont.setFamily(family);
+ itemViewFont.setFamily(family);
+ listViewFont.setFamily(family);
+ menuItemFont.setFamily(family);
+ editorFont.setFamily(family);
}
systemFont.setPixelSize(14);
@@ -61,14 +69,17 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
buttonFont.setCapitalization(QFont::AllUppercase);
buttonFont.setWeight(QFont::Medium);
+ toolTipFont.setPixelSize(14);
+ toolTipFont.setWeight(QFont::Medium);
+
itemViewFont.setPixelSize(14);
itemViewFont.setWeight(QFont::Medium);
+ listViewFont.setPixelSize(16);
+
menuItemFont.setPixelSize(16);
-}
-QQuickMaterialTheme::~QQuickMaterialTheme()
-{
+ editorFont.setPixelSize(16);
}
const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
@@ -78,11 +89,17 @@ const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
case QPlatformTheme::PushButtonFont:
case QPlatformTheme::ToolButtonFont:
return &buttonFont;
+ case QPlatformTheme::TipLabelFont:
+ return &toolTipFont;
case QPlatformTheme::ItemViewFont:
return &itemViewFont;
+ case QPlatformTheme::ListViewFont:
+ return &listViewFont;
case QPlatformTheme::MenuItemFont:
case QPlatformTheme::ComboMenuItemFont:
return &menuItemFont;
+ case QPlatformTheme::EditorFont:
+ return &editorFont;
default:
return &systemFont;
}