aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikita Krupenko <krnekit@gmail.com>2016-04-14 01:08:16 +0300
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-04-14 09:22:46 +0000
commited9720ffc6b462889e2f501824e9656a6ffde313 (patch)
tree91209d14e5442ffe68747ffbf62033f8be5b3c78 /src
parente2ee646a3f25f7fe0767d9af2beafe33b31cc07a (diff)
Use font from theme for list delegates
Change-Id: I48208fb6b5f7df6e1e824d36a256d9b1643cd16d Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp5
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h1
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp5
-rw-r--r--src/quicktemplates2/qquickcheckdelegate_p.h2
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp5
-rw-r--r--src/quicktemplates2/qquickradiodelegate_p.h2
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp2
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp5
-rw-r--r--src/quicktemplates2/qquickswitchdelegate_p.h1
9 files changed, 27 insertions, 1 deletions
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 66febc28..1f3bba49 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -53,6 +53,7 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
systemFont.setFamily(family);
buttonFont.setFamily(family);
itemViewFont.setFamily(family);
+ listViewFont.setFamily(family);
menuItemFont.setFamily(family);
editorFont.setFamily(family);
}
@@ -66,6 +67,8 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
itemViewFont.setPixelSize(14);
itemViewFont.setWeight(QFont::Medium);
+ listViewFont.setPixelSize(16);
+
menuItemFont.setPixelSize(16);
editorFont.setPixelSize(16);
@@ -80,6 +83,8 @@ const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
return &buttonFont;
case QPlatformTheme::ItemViewFont:
return &itemViewFont;
+ case QPlatformTheme::ListViewFont:
+ return &listViewFont;
case QPlatformTheme::MenuItemFont:
case QPlatformTheme::ComboMenuItemFont:
return &menuItemFont;
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 92842675..8739a756 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -64,6 +64,7 @@ private:
QFont systemFont;
QFont buttonFont;
QFont itemViewFont;
+ QFont listViewFont;
QFont menuItemFont;
QFont editorFont;
};
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
index 8dafbd7e..2a08e702 100644
--- a/src/quicktemplates2/qquickcheckdelegate.cpp
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -157,6 +157,11 @@ void QQuickCheckDelegate::setCheckState(Qt::CheckState state)
emit checkedChanged();
}
+QFont QQuickCheckDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
void QQuickCheckDelegate::checkStateSet()
{
setCheckState(isChecked() ? Qt::Checked : Qt::Unchecked);
diff --git a/src/quicktemplates2/qquickcheckdelegate_p.h b/src/quicktemplates2/qquickcheckdelegate_p.h
index 45d5b15f..10b10488 100644
--- a/src/quicktemplates2/qquickcheckdelegate_p.h
+++ b/src/quicktemplates2/qquickcheckdelegate_p.h
@@ -74,6 +74,8 @@ Q_SIGNALS:
void checkStateChanged();
protected:
+ QFont defaultFont() const override;
+
void checkStateSet() override;
void nextCheckState() override;
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
index 81eb20ae..aff57491 100644
--- a/src/quicktemplates2/qquickradiodelegate.cpp
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -85,6 +85,11 @@ QQuickRadioDelegate::QQuickRadioDelegate(QQuickItem *parent) :
setAutoExclusive(true);
}
+QFont QQuickRadioDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role QQuickRadioDelegate::accessibleRole() const
{
diff --git a/src/quicktemplates2/qquickradiodelegate_p.h b/src/quicktemplates2/qquickradiodelegate_p.h
index b77969a8..b5de6aa6 100644
--- a/src/quicktemplates2/qquickradiodelegate_p.h
+++ b/src/quicktemplates2/qquickradiodelegate_p.h
@@ -62,6 +62,8 @@ public:
explicit QQuickRadioDelegate(QQuickItem *parent = nullptr);
protected:
+ QFont defaultFont() const override;
+
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const override;
#endif
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 82030646..aa54237c 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -842,7 +842,7 @@ void QQuickSwipeDelegate::mouseReleaseEvent(QMouseEvent *event)
QFont QQuickSwipeDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ItemViewFont);
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index aefe2e6d..286d253b 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -148,6 +148,11 @@ qreal QQuickSwitchDelegate::visualPosition() const
return d->position;
}
+QFont QQuickSwitchDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
void QQuickSwitchDelegate::mirrorChange()
{
QQuickItemDelegate::mirrorChange();
diff --git a/src/quicktemplates2/qquickswitchdelegate_p.h b/src/quicktemplates2/qquickswitchdelegate_p.h
index 95b96d31..af931863 100644
--- a/src/quicktemplates2/qquickswitchdelegate_p.h
+++ b/src/quicktemplates2/qquickswitchdelegate_p.h
@@ -73,6 +73,7 @@ Q_SIGNALS:
void visualPositionChanged();
protected:
+ QFont defaultFont() const override;
void mirrorChange() override;
private: