aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/qquickmaterialstyle_p.h
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-02-12 10:20:06 +0100
committerMitch Curtis <mitch.curtis@qt.io>2018-02-19 15:48:03 +0000
commit55fa922b4f9350c320a4a949b70498269f0aaf79 (patch)
treeaef0292380fc40dd639cfea93d1ad503bf2bb122 /src/imports/controls/material/qquickmaterialstyle_p.h
parenta57754609cec57d1298bbcd1206fb0f114c7610e (diff)
Add Dense Material style variant for desktop
The current Material style is based on the mobile variant of the design, which is far too large for desktop applications. From https://material.io/guidelines/components/lists.html#lists-usage: "When the mouse and keyboard are the primary input methods, measurements may be condensed to accommodate denser layouts." This patch adds a dense variant of the style where most controls like buttons and delegates are smaller in height and use smaller font sizes. Note that the Material design guidelines seem to distinguish between mobile, desktop and dense measurements, where "dense" seems to be a specialization of desktop. We cannot afford to/do not see sense in maintaining three separate variants, so the dense variant will be the only desktop version of the Material style. [ChangeLog][Material] Added Dense variant of the Material style for use on desktop platforms. Some controls are slightly smaller in height and use smaller font sizes. The variant can be enabled by setting QT_QUICK_CONTROLS_MATERIAL_VARIANT to Dense or setting Variant=Dense in the qtquickcontrols.conf file. Task-number: QTBUG-51109 Change-Id: I11846b7f6e61f7b5dcf3c146b18c220234a73ef2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/controls/material/qquickmaterialstyle_p.h')
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 4b63747c..37baa450 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -98,6 +98,16 @@ class QQuickMaterialStyle : public QQuickAttachedObject
Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(int buttonHeight READ buttonHeight CONSTANT FINAL)
+ Q_PROPERTY(int delegateHeight READ delegateHeight CONSTANT FINAL)
+ Q_PROPERTY(int dialogButtonBoxHeight READ dialogButtonBoxHeight CONSTANT FINAL)
+ Q_PROPERTY(int frameVerticalPadding READ frameVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int itemDelegateVerticalPadding READ itemDelegateVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int menuItemHeight READ menuItemHeight CONSTANT FINAL)
+ Q_PROPERTY(int menuItemVerticalPadding READ menuItemVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int switchDelegateVerticalPadding READ switchDelegateVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int tooltipHeight READ tooltipHeight CONSTANT FINAL)
+
public:
enum Theme {
Light,
@@ -105,6 +115,11 @@ public:
System
};
+ enum Variant {
+ Normal,
+ Dense
+ };
+
enum Color {
Red,
Pink,
@@ -145,6 +160,7 @@ public:
};
Q_ENUM(Theme)
+ Q_ENUM(Variant)
Q_ENUM(Color)
Q_ENUM(Shade)
@@ -225,8 +241,20 @@ public:
Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const;
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const;
+ int buttonHeight() const;
+ int delegateHeight() const;
+ int dialogButtonBoxHeight() const;
+ int frameVerticalPadding() const;
+ int itemDelegateVerticalPadding() const;
+ int menuItemHeight() const;
+ int menuItemVerticalPadding() const;
+ int switchDelegateVerticalPadding() const;
+ int tooltipHeight() const;
+
static void initGlobals();
+ static Variant variant();
+
Q_SIGNALS:
void themeChanged();
void primaryChanged();