diff options
Diffstat (limited to 'examples/quickcontrols2/gallery')
3 files changed, 26 insertions, 19 deletions
diff --git a/examples/quickcontrols2/gallery/doc/src/qtquickcontrols2-gallery.qdoc b/examples/quickcontrols2/gallery/doc/src/qtquickcontrols2-gallery.qdoc index 463acdee..17496043 100644 --- a/examples/quickcontrols2/gallery/doc/src/qtquickcontrols2-gallery.qdoc +++ b/examples/quickcontrols2/gallery/doc/src/qtquickcontrols2-gallery.qdoc @@ -55,7 +55,7 @@ \endraw The gallery example is a simple application with a drawer menu that contains - all the \l {Qt Quick Controls 2}. Each menu item opens a page that shows the + all the \l {Qt Quick Controls}. Each menu item opens a page that shows the graphical appearance of a control, allows you to interact with the control, and explains in which circumstances it is handy to use this control. 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() } diff --git a/examples/quickcontrols2/gallery/pages/TabBarPage.qml b/examples/quickcontrols2/gallery/pages/TabBarPage.qml index 7f5cbce5..7c3cae44 100644 --- a/examples/quickcontrols2/gallery/pages/TabBarPage.qml +++ b/examples/quickcontrols2/gallery/pages/TabBarPage.qml @@ -74,7 +74,7 @@ Page { width: parent.width wrapMode: Label.Wrap horizontalAlignment: Qt.AlignHCenter - text: "TabBar is a bar with icons or text which allows the user" + text: "TabBar is a bar with icons or text which allows the user " + "to switch between different subtasks, views, or modes." } |