Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.12
- import QtQuick.Controls 2.12
- ApplicationWindow {
- visible: true
- width: 640
- height: 480
- title: qsTr("Hello World")
- ListModel {
- id: listModel
- ListElement { name: "Max"; lastname: "Vor"; counter: 0 }
- }
- ListView {
- anchors.fill: parent
- model: listModel
- delegate: ItemDelegate {
- icon.source: "qrc:/updater.png"
- icon.color: "transparent"
- text: 'Item name: %1\nLastName: %2\nCounter: %3'
- .arg(name)
- .arg(lastname)
- .arg(counter)
- width: parent.width
- onClicked: {
- popup.modelItem = model
- popup.open()
- }
- }
- }
- Popup {
- id: popup
- parent: overlay
- anchors.centerIn: parent
- property var modelItem
- Column {
- Label {
- text: popup.modelItem ? 'Item name: %1\nLastName: %2\nCounter: %3'
- .arg(popup.modelItem.name)
- .arg(popup.modelItem.lastname)
- .arg(popup.modelItem.counter): ""
- }
- SpinBox {
- value: (popup.modelItem ? popup.modelItem.counter : 0)
- onValueModified: popup.modelItem.counter = value
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement