MyDelegate.qml Example File
localstorage/localstorage/MyDelegate.qml
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Layouts 1.1
import "Database.js" as JS
Item {
width: parent.width
height: rDate.implicitHeight
Rectangle {
id: baseRec
anchors.fill: parent
opacity: 0.8
color: index % 2 ? "lightgrey" : "grey"
MouseArea {
anchors.fill: parent
onClicked: listView.currentIndex = index
}
GridLayout {
anchors.fill:parent
columns: 3
Text {
id: rDate
text: date
font.pixelSize: 22
Layout.preferredWidth: parent.width / 4
color: "black"
}
Text {
id: rDesc
text: trip_desc
Layout.fillWidth: true
font.pixelSize: 22
color: "black"
}
Text {
id: rDistance
text: distance
font.pixelSize: 22
Layout.alignment: Qt.AlignRight
color: "black"
}
}
}
}