2018-02-23 14:39:14 +00:00
|
|
|
import QtQuick 2.10
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQuick.Controls.Material 2.3
|
|
|
|
|
|
|
|
Item {
|
2018-03-01 11:15:04 +00:00
|
|
|
property Item page
|
2018-02-23 14:39:14 +00:00
|
|
|
property alias contentItem: itemDelegate.contentItem
|
|
|
|
signal clicked
|
|
|
|
|
|
|
|
id: buttonDelegate
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: width
|
|
|
|
|
|
|
|
Rectangle {
|
2018-03-01 11:15:04 +00:00
|
|
|
width: stackView.currentItem === page ? parent.width : 0
|
2018-02-23 14:39:14 +00:00
|
|
|
height: parent.height
|
|
|
|
anchors.bottom: itemDelegate.bottom
|
|
|
|
color: Qt.lighter(Material.accent)
|
|
|
|
|
|
|
|
Behavior on width {
|
2018-03-01 11:15:04 +00:00
|
|
|
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
|
2018-02-23 14:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ItemDelegate {
|
|
|
|
id: itemDelegate
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
onClicked: {
|
2018-03-01 11:15:04 +00:00
|
|
|
if(page != null) {
|
|
|
|
if(stackView.depth === 1) {
|
|
|
|
stackView.replace(page)
|
|
|
|
} else {
|
|
|
|
stackView.clear()
|
|
|
|
stackView.push(page)
|
|
|
|
}
|
|
|
|
}
|
2018-02-23 14:39:14 +00:00
|
|
|
buttonDelegate.clicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|