aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-09 11:33:12 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-10 10:04:09 +0100
commit492586930b4edbee5a8ab13de3fead9efa1b3e38 (patch)
tree9547b2b14d94b84b3a484a81baae532712e4afe6 /examples
parentec686af14f817cc51323cfb01186f036905789c3 (diff)
Gallery example: Add "Help" menu and shortcut
Add a property "control" identifying the control to be demo-ed to the page and add a help shortcut and menu item displaying its help. Change-Id: Ic3c7c31f5a44fccd57ee018fd3681dc6bdffee58 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml18
-rw-r--r--examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ButtonPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/CheckBoxPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ComboBoxPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/DelayButtonPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/DelegatePage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/DialPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/DialogPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/FramePage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/GroupBoxPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ProgressBarPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/RadioButtonPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/RangeSliderPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ScrollBarPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ScrollIndicatorPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ScrollablePage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/SliderPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/SpinBoxPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/StackViewPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/SwipeViewPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/SwitchPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/TabBarPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/TextAreaPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/TextFieldPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/ToolTipPage.qml2
-rw-r--r--examples/quickcontrols2/gallery/pages/TumblerPage.qml2
28 files changed, 72 insertions, 0 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index 44987adaf9..95fc739f02 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -62,6 +62,15 @@ ApplicationWindow {
visible: true
title: "Qt Quick Controls 2"
+ function help()
+ {
+ var url = "https://doc.qt.io/qt-5/"
+ + (stackView.depth > 1
+ ? "qml-qtquick-controls2-" + stackView.currentItem.control + ".html"
+ : "qtquick-controls2-qmlmodule.html");
+ Qt.openUrlExternally(url)
+ }
+
Settings {
id: settings
property string style: "Default"
@@ -73,6 +82,11 @@ ApplicationWindow {
onActivated: navigateBackAction.trigger()
}
+ Shortcut {
+ sequence: StandardKey.HelpContents
+ onActivated: help()
+ }
+
Action {
id: navigateBackAction
icon.name: stackView.depth > 1 ? "back" : "drawer"
@@ -131,6 +145,10 @@ ApplicationWindow {
onTriggered: settingsDialog.open()
}
Action {
+ text: "Help"
+ onTriggered: help()
+ }
+ Action {
text: "About"
onTriggered: aboutDialog.open()
}
diff --git a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
index b0aa6284b5..504993f20c 100644
--- a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
+++ b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "busyindicator"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ButtonPage.qml b/examples/quickcontrols2/gallery/pages/ButtonPage.qml
index c77b41e4dc..dce39203c1 100644
--- a/examples/quickcontrols2/gallery/pages/ButtonPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ButtonPage.qml
@@ -55,6 +55,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "button"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
index 7795f814d0..ac1ed4b711 100644
--- a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "checkbox"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
index ec75607c27..b194da7f92 100644
--- a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "combobox"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/DelayButtonPage.qml b/examples/quickcontrols2/gallery/pages/DelayButtonPage.qml
index 91110567f6..ea73e6a7c3 100644
--- a/examples/quickcontrols2/gallery/pages/DelayButtonPage.qml
+++ b/examples/quickcontrols2/gallery/pages/DelayButtonPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ property string control : "delaybutton"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/DelegatePage.qml b/examples/quickcontrols2/gallery/pages/DelegatePage.qml
index 30f07be1dc..4c3f0333ab 100644
--- a/examples/quickcontrols2/gallery/pages/DelegatePage.qml
+++ b/examples/quickcontrols2/gallery/pages/DelegatePage.qml
@@ -55,6 +55,8 @@ import QtQuick.Controls 2.12
Pane {
padding: 0
+ property string control : "swipedelegate"
+
property var delegateComponentMap: {
"ItemDelegate": itemDelegateComponent,
"SwipeDelegate": swipeDelegateComponent,
diff --git a/examples/quickcontrols2/gallery/pages/DialPage.qml b/examples/quickcontrols2/gallery/pages/DialPage.qml
index 3bb3bb2867..8372d56fe9 100644
--- a/examples/quickcontrols2/gallery/pages/DialPage.qml
+++ b/examples/quickcontrols2/gallery/pages/DialPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "dial"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/DialogPage.qml b/examples/quickcontrols2/gallery/pages/DialogPage.qml
index 9d23e26098..167fa186b4 100644
--- a/examples/quickcontrols2/gallery/pages/DialogPage.qml
+++ b/examples/quickcontrols2/gallery/pages/DialogPage.qml
@@ -55,6 +55,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "dialog"
+
readonly property int buttonWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, page.availableWidth / 3))
Column {
diff --git a/examples/quickcontrols2/gallery/pages/FramePage.qml b/examples/quickcontrols2/gallery/pages/FramePage.qml
index 4834d04da4..5d4b2f7bef 100644
--- a/examples/quickcontrols2/gallery/pages/FramePage.qml
+++ b/examples/quickcontrols2/gallery/pages/FramePage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "frame"
+
readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2))
Column {
diff --git a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
index 16f8762a40..41f115a79a 100644
--- a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "groupbox"
+
readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2))
Column {
diff --git a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
index 4f13ce3332..dd0d3e9cc6 100644
--- a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
+++ b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "pageindicator"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
index 1f3c81b985..89b951ee73 100644
--- a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "progressbar"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
index b573731e21..9685426ef0 100644
--- a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
+++ b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "radiobutton"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
index b6c357664b..d04e7cb45c 100644
--- a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
+++ b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "rangeslider"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ScrollBarPage.qml b/examples/quickcontrols2/gallery/pages/ScrollBarPage.qml
index d9e77fa4bc..8ebf65ac31 100644
--- a/examples/quickcontrols2/gallery/pages/ScrollBarPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ScrollBarPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
Flickable {
id: flickable
+ readonly property string control : "scrollbar"
+
contentHeight: pane.height
Pane {
diff --git a/examples/quickcontrols2/gallery/pages/ScrollIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/ScrollIndicatorPage.qml
index 2adcbc6b93..4aa641a87e 100644
--- a/examples/quickcontrols2/gallery/pages/ScrollIndicatorPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ScrollIndicatorPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
Flickable {
id: flickable
+ readonly property string control : "scrollindicator"
+
contentHeight: pane.height
Pane {
diff --git a/examples/quickcontrols2/gallery/pages/ScrollablePage.qml b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml
index afb5ef5c15..2d525cf688 100644
--- a/examples/quickcontrols2/gallery/pages/ScrollablePage.qml
+++ b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
Page {
id: page
+ readonly property string control : "flickable"
+
default property alias content: pane.contentItem
Flickable {
diff --git a/examples/quickcontrols2/gallery/pages/SliderPage.qml b/examples/quickcontrols2/gallery/pages/SliderPage.qml
index 93a1ebb1a6..9a2f3bafaf 100644
--- a/examples/quickcontrols2/gallery/pages/SliderPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SliderPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "slider"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
index 9e45833176..7ad62caacf 100644
--- a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : ""
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/StackViewPage.qml b/examples/quickcontrols2/gallery/pages/StackViewPage.qml
index 43ee568494..d52cf85a67 100644
--- a/examples/quickcontrols2/gallery/pages/StackViewPage.qml
+++ b/examples/quickcontrols2/gallery/pages/StackViewPage.qml
@@ -55,6 +55,8 @@ StackView {
id: stackView
initialItem: page
+ readonly property string control : "stackview"
+
Component {
id: page
diff --git a/examples/quickcontrols2/gallery/pages/SwipeViewPage.qml b/examples/quickcontrols2/gallery/pages/SwipeViewPage.qml
index 3c3bc56cce..c55250e4a0 100644
--- a/examples/quickcontrols2/gallery/pages/SwipeViewPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SwipeViewPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
Pane {
id: pane
+ readonly property string control : "swipeview"
+
SwipeView {
id: view
currentIndex: 1
diff --git a/examples/quickcontrols2/gallery/pages/SwitchPage.qml b/examples/quickcontrols2/gallery/pages/SwitchPage.qml
index 53ee1660a0..9e3f03f805 100644
--- a/examples/quickcontrols2/gallery/pages/SwitchPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SwitchPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "switch"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/TabBarPage.qml b/examples/quickcontrols2/gallery/pages/TabBarPage.qml
index 7c3cae44fd..1bfda1c188 100644
--- a/examples/quickcontrols2/gallery/pages/TabBarPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TabBarPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
Page {
id: page
+ readonly property string control : "tabbar"
+
SwipeView {
id: swipeView
anchors.fill: parent
diff --git a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
index 7ed2b58b82..4a6d25e7c5 100644
--- a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "textarea"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
index 37a5d605a1..527f7a646d 100644
--- a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "textfield"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
index 295ea2c456..fea055514f 100644
--- a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "tooltip"
+
Column {
spacing: 40
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/TumblerPage.qml b/examples/quickcontrols2/gallery/pages/TumblerPage.qml
index af4caee3a8..a7c95d210e 100644
--- a/examples/quickcontrols2/gallery/pages/TumblerPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TumblerPage.qml
@@ -54,6 +54,8 @@ import QtQuick.Controls 2.12
ScrollablePage {
id: page
+ readonly property string control : "tumbler"
+
Column {
spacing: 40
width: parent.width