aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/gallery/gallery.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-26 14:10:14 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-26 14:13:35 +0200
commit11b066beb45e7da084c6f792cf9421d48d4b40bf (patch)
tree0a27017508682b812b9fa533a3cab95aeb3c33c6 /examples/quickcontrols2/gallery/gallery.qml
parentf1eef22d0d1ddcc2ee48e45e522788eb97f429b0 (diff)
parentd1efdcd2beac4d40d06ac7258b4d84e4376ab9d6 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc src/quicktemplates2/qquickstackview_p.cpp src/quicktemplates2/qquickstackview_p_p.h tests/auto/controls/data/tst_stackview.qml Change-Id: If451fe0e5653572d305b4de90a6d5cb878463e8d
Diffstat (limited to 'examples/quickcontrols2/gallery/gallery.qml')
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml17
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index 753a8c0081..bead5434a2 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -69,14 +69,21 @@ ApplicationWindow {
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
- source: "qrc:/images/drawer.png"
+ source: stackView.depth > 1 ? "images/back.png" : "images/drawer.png"
+ }
+ onClicked: {
+ if (stackView.depth > 1) {
+ stackView.pop()
+ listView.currentIndex = -1
+ } else {
+ drawer.open()
+ }
}
- onClicked: drawer.open()
}
Label {
id: titleLabel
- text: "Gallery"
+ text: listView.currentItem ? listView.currentItem.text : "Gallery"
font.pixelSize: 20
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
@@ -115,6 +122,7 @@ ApplicationWindow {
id: drawer
width: Math.min(window.width, window.height) / 3 * 2
height: window.height
+ dragMargin: stackView.depth > 1 ? 0 : undefined
ListView {
id: listView
@@ -128,8 +136,7 @@ ApplicationWindow {
onClicked: {
if (listView.currentIndex != index) {
listView.currentIndex = index
- titleLabel.text = model.title
- stackView.replace(model.source)
+ stackView.push(model.source)
}
drawer.close()
}