Changeset View
Changeset View
Standalone View
Standalone View
src/MediaBrowser.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.4 | 20 | import QtQuick 2.4 | ||
21 | import QtQuick.Controls 1.2 | 21 | import QtQuick.Controls 1.2 | ||
22 | import QtQuick.Controls.Styles 1.2 | 22 | import QtQuick.Controls.Styles 1.2 | ||
23 | import QtQuick.Layouts 1.1 | 23 | import QtQuick.Layouts 1.1 | ||
24 | import QtQuick.Window 2.2 | 24 | import QtQuick.Window 2.2 | ||
25 | import org.kde.elisa 1.0 | 25 | import org.kde.elisa 1.0 | ||
26 | 26 | | |||
27 | FocusScope { | 27 | FocusScope { | ||
28 | id: contentDirectoryRoot | ||||
29 | | ||||
28 | property MediaPlayList playListModel | 30 | property MediaPlayList playListModel | ||
29 | property var firstPage | 31 | property var firstPage | ||
30 | property alias stackView: listingView | 32 | property alias stackView: listingView | ||
31 | 33 | | |||
mgallien: You should use a function. I believe that it should also work but does not involve defining a… | |||||
32 | id: contentDirectoryRoot | 34 | function goBack() { | ||
35 | if (listingView.depth > 1) { | ||||
36 | listingView.pop() | ||||
37 | } | ||||
38 | } | ||||
33 | 39 | | |||
34 | ColumnLayout { | 40 | ColumnLayout { | ||
35 | anchors.fill: parent | 41 | anchors.fill: parent | ||
If you would like to do this kind of change, please do it globally and in a separate review. mgallien: If you would like to do this kind of change, please do it globally and in a separate review. | |||||
36 | spacing: 0 | 42 | spacing: 0 | ||
37 | 43 | | |||
38 | StackView { | 44 | StackView { | ||
39 | id: listingView | 45 | id: listingView | ||
40 | 46 | | |||
41 | Layout.fillHeight: true | 47 | Layout.fillHeight: true | ||
42 | Layout.fillWidth: true | 48 | Layout.fillWidth: true | ||
43 | 49 | | |||
Show All 17 Lines | 65 | PropertyAnimation { | |||
61 | property: "opacity" | 67 | property: "opacity" | ||
62 | from: 1 | 68 | from: 1 | ||
63 | to: 0 | 69 | to: 0 | ||
64 | } | 70 | } | ||
65 | } | 71 | } | ||
66 | } | 72 | } | ||
67 | 73 | | |||
68 | initialItem: firstPage | 74 | initialItem: firstPage | ||
69 | | ||||
70 | // Implements back key navigation | | |||
71 | Keys.onReleased: if (event.key === Qt.Key_Back && listingView.depth > 1) { | | |||
72 | listingView.pop(); | | |||
73 | event.accepted = true; | | |||
74 | } | 75 | } | ||
75 | } | 76 | } | ||
77 | | ||||
78 | MouseArea { | ||||
79 | anchors.fill: parent | ||||
80 | acceptedButtons: Qt.BackButton | ||||
81 | onClicked: goBack() | ||||
76 | } | 82 | } | ||
77 | } | 83 | } |
You should use a function. I believe that it should also work but does not involve defining a signal handler inside the object.