diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2017-03-09 20:01:27 +0200 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2017-03-10 18:09:25 +0000 |
commit | eba62334a9b646f61e73b5b734ec5971e56d672a (patch) | |
tree | cf2b6f8db6e3c27f62bc32d7fd61f0c901815c5b /src/imports/controls/material/qquickmaterialtheme.cpp | |
parent | e91c9feab8a0cf4cff71cc68ab0f001b1531504f (diff) |
Material: use proper layout of the buttons in the DialogButtonBox
Instead of using system button layout, use layout from macOS, which
better fits the Material Design guidelines and also used in the Android
QPA plugin.
Task-number: QTBUG-58060
Change-Id: I06381219b5f1ad0a32742487fd314a8017d82dfc
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/controls/material/qquickmaterialtheme.cpp')
-rw-r--r-- | src/imports/controls/material/qquickmaterialtheme.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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 |