First commit.
This commit is contained in:
36
qml/component/ButtonDelegate.qml
Normal file
36
qml/component/ButtonDelegate.qml
Normal file
@@ -0,0 +1,36 @@
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.3
|
||||
|
||||
Item {
|
||||
property int index
|
||||
property alias contentItem: itemDelegate.contentItem
|
||||
signal clicked
|
||||
|
||||
id: buttonDelegate
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width
|
||||
|
||||
Rectangle {
|
||||
width: swipeView.currentIndex === index ? parent.width : 0
|
||||
height: parent.height
|
||||
anchors.bottom: itemDelegate.bottom
|
||||
color: Qt.lighter(Material.accent)
|
||||
|
||||
Behavior on width {
|
||||
PropertyAnimation { easing.type: Easing.InOutQuad; duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
id: itemDelegate
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
swipeView.currentIndex = index
|
||||
buttonDelegate.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user