aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-18 15:56:51 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-18 15:56:51 +0200
commitf5b91d87a49c4e34063e72aa06a0f3d8eb1be50a (patch)
treeea73d00b663b00dc78a52d02914755544bef6358 /src/imports/controls
parentbfc784a53771e4cb700e07495125b20a4f3b949c (diff)
parent91e29613f9671989455345a01da9f840a98d06f9 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/material/DialogButtonBox.qml5
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp18
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h3
3 files changed, 24 insertions, 2 deletions
diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml
index c36a7749..c4b3e0ad 100644
--- a/src/imports/controls/material/DialogButtonBox.qml
+++ b/src/imports/controls/material/DialogButtonBox.qml
@@ -50,8 +50,8 @@ T.DialogButtonBox {
spacing: 8
padding: 8
- topPadding: padding - 4
- bottomPadding: padding - 4
+ topPadding: 2
+ bottomPadding: 2
alignment: Qt.AlignRight
Material.foreground: Material.accent
@@ -73,6 +73,7 @@ T.DialogButtonBox {
implicitHeight: 52
radius: 2
color: control.Material.dialogColor
+ // Rounded corners should be only at the top or at the bottom
topPadding: control.position === T.DialogButtonBox.Footer ? -2 : 0
bottomPadding: control.position === T.DialogButtonBox.Header ? -2 : 0
clip: true
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 63def7a5..3ea41779 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -36,6 +36,7 @@
#include "qquickmaterialtheme_p.h"
+#include <QtGui/qpa/qplatformdialoghelper.h>
#include <QtGui/qfont.h>
#include <QtGui/qfontinfo.h>
@@ -105,4 +106,21 @@ const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
}
}
+QVariant QQuickMaterialTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case QPlatformTheme::DialogButtonBoxLayout:
+ // https://material.io/guidelines/components/dialogs.html#dialogs-specs
+ // As per spec, affirmative actions are placed to the right, dismissive
+ // actions are placed directly to the left of affirmative actions.
+ // In the Android sources, there are additional type of actions -
+ // neutral, which are placed to the left.
+ // Rules for macOS seems to be the most suitable here and are also used
+ // in the Android QPA plugin.
+ return QVariant(QPlatformDialogHelper::MacLayout);
+ default:
+ return QQuickProxyTheme::themeHint(hint);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 828ca83a..d505d4ff 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -48,6 +48,7 @@
// We mean it.
//
+#include <QtCore/qvariant.h>
#include <QtGui/qfont.h>
#include <QtQuickControls2/private/qquickproxytheme_p.h>
@@ -60,6 +61,8 @@ public:
const QFont *font(Font type = SystemFont) const override;
+ QVariant themeHint(ThemeHint hint) const override;
+
private:
QFont systemFont;
QFont buttonFont;