diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 10:35:29 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-06 10:35:29 +0200 |
commit | a9210349671ce374ceadfb03443c0b5d32280acb (patch) | |
tree | c96811461a8ff284d48c079277eb3b5342bc3a24 /examples | |
parent | 8701410f8c0e179c9cca51b08fcc6491a288ee84 (diff) | |
parent | 616c430d2b7f36e70987df7b2dc97e71f0e8b589 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I859406dc779e59ee5d8e2980e04f8be28b1a69aa
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/gallery/gallery.qml | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml index e9f0b432..44987ada 100644 --- a/examples/quickcontrols2/gallery/gallery.qml +++ b/examples/quickcontrols2/gallery/gallery.qml @@ -70,15 +70,31 @@ ApplicationWindow { Shortcut { sequences: ["Esc", "Back"] enabled: stackView.depth > 1 - onActivated: { - stackView.pop() - listView.currentIndex = -1 + onActivated: navigateBackAction.trigger() + } + + Action { + id: navigateBackAction + icon.name: stackView.depth > 1 ? "back" : "drawer" + onTriggered: { + if (stackView.depth > 1) { + stackView.pop() + listView.currentIndex = -1 + } else { + drawer.open() + } } } Shortcut { sequence: "Menu" - onActivated: optionsMenu.open() + onActivated: optionsMenuAction.trigger() + } + + Action { + id: optionsMenuAction + icon.name: "menu" + onTriggered: optionsMenu.open() } header: ToolBar { @@ -89,15 +105,7 @@ ApplicationWindow { anchors.fill: parent ToolButton { - icon.name: stackView.depth > 1 ? "back" : "drawer" - onClicked: { - if (stackView.depth > 1) { - stackView.pop() - listView.currentIndex = -1 - } else { - drawer.open() - } - } + action: navigateBackAction } Label { @@ -111,19 +119,18 @@ ApplicationWindow { } ToolButton { - icon.name: "menu" - onClicked: optionsMenu.open() + action: optionsMenuAction Menu { id: optionsMenu x: parent.width - width transformOrigin: Menu.TopRight - MenuItem { + Action { text: "Settings" onTriggered: settingsDialog.open() } - MenuItem { + Action { text: "About" onTriggered: aboutDialog.open() } |