Changeset View
Changeset View
Standalone View
Standalone View
examples/simpleexamples/AbstractApplicationWindow.qml
Show All 14 Lines | |||||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Controls 1.4 as Controls | 21 | import QtQuick.Controls 1.4 as Controls | ||
22 | import QtQuick.Layouts 1.2 | 22 | import QtQuick.Layouts 1.2 | ||
23 | import org.kde.kirigami 1.0 as Kirigami | 23 | import org.kde.kirigami 2.0 as Kirigami | ||
24 | 24 | | |||
25 | Kirigami.AbstractApplicationWindow { | 25 | Kirigami.AbstractApplicationWindow { | ||
26 | id: root | 26 | id: root | ||
27 | width: 500 | 27 | width: 500 | ||
28 | height: 800 | 28 | height: 800 | ||
29 | visible: true | 29 | visible: true | ||
30 | 30 | | |||
31 | globalDrawer: Kirigami.GlobalDrawer { | 31 | globalDrawer: Kirigami.GlobalDrawer { | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 113 | onDepthChanged: { | |||
114 | currentIndex = depth-1; | 114 | currentIndex = depth-1; | ||
115 | } | 115 | } | ||
116 | initialItem: mainPageComponent | 116 | initialItem: mainPageComponent | ||
117 | 117 | | |||
118 | Keys.onReleased: { | 118 | Keys.onReleased: { | ||
119 | if (event.key == Qt.Key_Back || | 119 | if (event.key == Qt.Key_Back || | ||
120 | (event.key === Qt.Key_Left && (event.modifiers & Qt.AltModifier))) { | 120 | (event.key === Qt.Key_Left && (event.modifiers & Qt.AltModifier))) { | ||
121 | event.accepted = true; | 121 | event.accepted = true; | ||
122 | if (root.contextDrawer && root.contextDrawer.opened) { | 122 | if (root.contextDrawer && root.contextDrawer.drawerOpen) { | ||
123 | root.contextDrawer.close(); | 123 | root.contextDrawer.close(); | ||
124 | } else if (root.globalDrawer && root.globalDrawer.opened) { | 124 | } else if (root.globalDrawer && root.globalDrawer.drawerOpen) { | ||
125 | root.globalDrawer.close(); | 125 | root.globalDrawer.close(); | ||
126 | } else { | 126 | } else { | ||
127 | var backEvent = {accepted: false} | 127 | var backEvent = {accepted: false} | ||
128 | if (root.pageStack.currentIndex >= 1) { | 128 | if (root.pageStack.currentIndex >= 1) { | ||
129 | root.pageStack.currentItem.backRequested(backEvent); | 129 | root.pageStack.currentItem.backRequested(backEvent); | ||
130 | if (!backEvent.accepted) { | 130 | if (!backEvent.accepted) { | ||
131 | if (root.pageStack.depth > 1) { | 131 | if (root.pageStack.depth > 1) { | ||
132 | root.pageStack.currentIndex = Math.max(0, root.pageStack.currentIndex - 1); | 132 | root.pageStack.currentIndex = Math.max(0, root.pageStack.currentIndex - 1); | ||
Show All 34 Lines |