aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2023-12-12 16:57:19 +0800
committerMitch Curtis <mitch.curtis@qt.io>2023-12-18 11:45:55 +0800
commit302124c03294df180add61928b7c444e2847d840 (patch)
treefcae3f1edf74ba2218fe409c0e26daa40e408727 /src/quickcontrols
parent540848a4ed0d4c5fee1cd18f7122d3f7a90c3094 (diff)
Material: reduce title pixel size and rounded scale of Dense Dialog
They were way too big for the Dense variant. Task-number: QTBUG-119793 Pick-to: 6.5 6.6 6.7 Change-Id: Ie6c26f1e7ea90057dbaf2eabcb9714e2bf7928dc Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/quickcontrols')
-rw-r--r--src/quickcontrols/material/Dialog.qml5
-rw-r--r--src/quickcontrols/material/qquickmaterialstyle.cpp13
-rw-r--r--src/quickcontrols/material/qquickmaterialstyle_p.h4
3 files changed, 19 insertions, 3 deletions
diff --git a/src/quickcontrols/material/Dialog.qml b/src/quickcontrols/material/Dialog.qml
index 33d8ce97d1..014fcc67c5 100644
--- a/src/quickcontrols/material/Dialog.qml
+++ b/src/quickcontrols/material/Dialog.qml
@@ -28,8 +28,7 @@ T.Dialog {
// https://m3.material.io/components/dialogs/specs#401a48c3-f50c-4fa9-b798-701f5adcf155
// Specs say level 3 (6 dp) is the default, yet the screenshots there show 0. Native Android defaults to non-zero.
Material.elevation: 6
- // https://m3.material.io/components/dialogs/specs#6771d107-624e-47cc-b6d8-2b7b620ba2f1
- Material.roundedScale: Material.ExtraLargeScale
+ Material.roundedScale: Material.dialogRoundedScale
enter: Transition {
// grow_fade_in
@@ -63,7 +62,7 @@ T.Dialog {
bottomPadding: 0
// TODO: QPlatformTheme::TitleBarFont
// https://m3.material.io/components/dialogs/specs#401a48c3-f50c-4fa9-b798-701f5adcf155
- font.pixelSize: 24
+ font.pixelSize: Material.dialogTitleFontPixelSize
background: PaddedRectangle {
radius: control.background.radius
color: control.Material.dialogColor
diff --git a/src/quickcontrols/material/qquickmaterialstyle.cpp b/src/quickcontrols/material/qquickmaterialstyle.cpp
index 5cc1243b79..f8ced5821b 100644
--- a/src/quickcontrols/material/qquickmaterialstyle.cpp
+++ b/src/quickcontrols/material/qquickmaterialstyle.cpp
@@ -1312,6 +1312,19 @@ int QQuickMaterialStyle::dialogButtonBoxHeight() const
return globalVariant == Dense ? 48 : 52;
}
+int QQuickMaterialStyle::dialogTitleFontPixelSize() const
+{
+ return globalVariant == Dense ? 16 : 24;
+}
+
+// https://m3.material.io/components/dialogs/specs#6771d107-624e-47cc-b6d8-2b7b620ba2f1
+QQuickMaterialStyle::RoundedScale QQuickMaterialStyle::dialogRoundedScale() const
+{
+ return globalVariant == Dense
+ ? QQuickMaterialStyle::RoundedScale::LargeScale
+ : QQuickMaterialStyle::RoundedScale::ExtraLargeScale;
+}
+
int QQuickMaterialStyle::frameVerticalPadding() const
{
return globalVariant == Dense ? 8 : 12;
diff --git a/src/quickcontrols/material/qquickmaterialstyle_p.h b/src/quickcontrols/material/qquickmaterialstyle_p.h
index 36c8c476cd..5ff27f532e 100644
--- a/src/quickcontrols/material/qquickmaterialstyle_p.h
+++ b/src/quickcontrols/material/qquickmaterialstyle_p.h
@@ -80,6 +80,8 @@ class QQuickMaterialStyle : public QQuickAttachedPropertyPropagator
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 dialogTitleFontPixelSize READ dialogTitleFontPixelSize CONSTANT FINAL)
+ Q_PROPERTY(RoundedScale dialogRoundedScale READ dialogRoundedScale CONSTANT FINAL)
Q_PROPERTY(int frameVerticalPadding READ frameVerticalPadding CONSTANT FINAL)
Q_PROPERTY(int menuItemHeight READ menuItemHeight CONSTANT FINAL)
Q_PROPERTY(int menuItemVerticalPadding READ menuItemVerticalPadding CONSTANT FINAL)
@@ -276,6 +278,8 @@ public:
int buttonHeight() const;
int delegateHeight() const;
int dialogButtonBoxHeight() const;
+ int dialogTitleFontPixelSize() const;
+ RoundedScale dialogRoundedScale() const;
int frameVerticalPadding() const;
int menuItemHeight() const;
int menuItemVerticalPadding() const;