diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2017-03-14 23:07:08 +0200 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2017-04-11 14:39:16 +0000 |
commit | 34f46588aa89537d2c90865694b30ffcda8c421f (patch) | |
tree | d9b0dbd333fc97f31a9fa6ae0980239697db6d61 /src/widgets | |
parent | b018a5ecef7b12c2d28df950a207ff3c7fc3abed (diff) |
Add button layout for dialogs on Android
It used macOS layout before, but it differs from the actual layout in
Android/Material Design: affirmative actions are on the right side,
dismissive actions are directly to the left of the affirmative actions
and neutral actions are on the left side.
[ChangeLog][Platform-specific Changes][Android] Android dialogs now have
more appropriate button layout, with affirmative actions on the right.
Task-number: QTBUG-58060
Change-Id: I0755f80261410c64cf4f854b7f2a72e2d959db28
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.h | 6 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 1bf6c082a1..f37476a78e 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -1793,8 +1793,9 @@ a QMessageBox. The possible values are 0 (\l{QDialogButtonBox::}{WinLayout}), 1 (\l{QDialogButtonBox::}{MacLayout}), 2 - (\l{QDialogButtonBox::}{KdeLayout}), and 3 - (\l{QDialogButtonBox::}{GnomeLayout}). + (\l{QDialogButtonBox::}{KdeLayout}), 3 + (\l{QDialogButtonBox::}{GnomeLayout}) and 5 + (\l{QDialogButtonBox::}{AndroidLayout}). If this property is not specified, it defaults to the value specified by the current style for the diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index a3e55114bb..ad16acb96c 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -577,6 +577,8 @@ QDialogButtonBox::~QDialogButtonBox() \value MacLayout Use a policy appropriate for applications on \macos. \value KdeLayout Use a policy appropriate for applications on KDE. \value GnomeLayout Use a policy appropriate for applications on GNOME. + \value AndroidLayout Use a policy appropriate for applications on Android. + This enum value was added in Qt 5.10. The button layout is specified by the \l{style()}{current style}. However, on the X11 platform, it may be influenced by the desktop environment. diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h index af9e705234..02d14dee7c 100644 --- a/src/widgets/widgets/qdialogbuttonbox.h +++ b/src/widgets/widgets/qdialogbuttonbox.h @@ -108,11 +108,13 @@ public: Q_FLAG(StandardButtons) enum ButtonLayout { - // keep this in sync with QMessageBox::ButtonLayout and QPlatformDialogHelper::ButtonLayout + // keep this in sync with QPlatformDialogHelper::ButtonLayout WinLayout, MacLayout, KdeLayout, - GnomeLayout + GnomeLayout, + // MacModelessLayout, + AndroidLayout = GnomeLayout + 2 // ### Qt 6: reorder }; QDialogButtonBox(QWidget *parent = Q_NULLPTR); |