diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-15 22:04:24 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-18 20:37:12 +0000 |
commit | 7a835a4b4e350710ac8fc45c7f3cbb25ea7a5fe0 (patch) | |
tree | ec5c1a1826ddf17cda630301a52311e5fc60648d /examples/quickcontrols2/gallery/gallery.qml | |
parent | 8a1eb34740bc5bc4db4972ab2b2a8e738dca979a (diff) |
Add Dialog
[ChangeLog][Controls] Added Dialog to provide convenience for handling
dialog popups. Dialog integrates with DialogButtonBox, and provides
convenient accepted() and rejected() signals.
Task-number: QTBUG-51090
Change-Id: I776516738b82c0e5726769c054d6f2a956fb616d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quickcontrols2/gallery/gallery.qml')
-rw-r--r-- | examples/quickcontrols2/gallery/gallery.qml | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml index c603184ae6..753a8c0081 100644 --- a/examples/quickcontrols2/gallery/gallery.qml +++ b/examples/quickcontrols2/gallery/gallery.qml @@ -207,7 +207,7 @@ ApplicationWindow { } } - Popup { + Dialog { id: settingsDialog x: Math.round((window.width - width) / 2) y: Math.round(window.height / 6) @@ -216,6 +216,16 @@ ApplicationWindow { modal: true focus: true + standardButtons: Dialog.Ok | Dialog.Cancel + onAccepted: { + settings.style = styleBox.displayText + settingsDialog.close() + } + onRejected: { + styleBox.currentIndex = styleBox.styleIndex + settingsDialog.close() + } + contentItem: ColumnLayout { id: settingsColumn spacing: 20 @@ -254,22 +264,10 @@ ApplicationWindow { Layout.fillWidth: true Layout.fillHeight: true } - - DialogButtonBox { - standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel - onAccepted: { - settings.style = styleBox.displayText - settingsDialog.close() - } - onRejected: { - styleBox.currentIndex = styleBox.styleIndex - settingsDialog.close() - } - } } } - Popup { + Dialog { id: aboutDialog modal: true focus: true |