2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-12-07 03:03:08 +00:00
|
|
|
|
2022-10-17 17:14:55 +00:00
|
|
|
pragma ComponentBehavior: Bound
|
2011-12-07 03:03:08 +00:00
|
|
|
//![0]
|
2022-08-31 07:59:05 +00:00
|
|
|
import QtQuick
|
2011-12-07 03:03:08 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2023-03-15 08:53:23 +00:00
|
|
|
width: 300
|
|
|
|
height: 400
|
2011-12-07 03:03:08 +00:00
|
|
|
|
|
|
|
//![1]
|
|
|
|
Component {
|
|
|
|
id: dragDelegate
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: content
|
|
|
|
|
2022-10-17 17:14:55 +00:00
|
|
|
required property string name
|
|
|
|
required property string type
|
|
|
|
required property string size
|
|
|
|
required property int age
|
|
|
|
|
|
|
|
width: view.width
|
2011-12-07 03:03:08 +00:00
|
|
|
height: column.implicitHeight + 4
|
|
|
|
|
|
|
|
border.width: 1
|
|
|
|
border.color: "lightsteelblue"
|
|
|
|
|
|
|
|
radius: 2
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column
|
2023-03-15 08:53:23 +00:00
|
|
|
anchors {
|
|
|
|
fill: parent
|
|
|
|
margins: 2
|
|
|
|
}
|
2011-12-07 03:03:08 +00:00
|
|
|
|
2023-03-15 08:53:23 +00:00
|
|
|
Text { text: qsTr('Name: ') + content.name }
|
|
|
|
Text { text: qsTr('Type: ') + content.type }
|
|
|
|
Text { text: qsTr('Age: ') + content.age }
|
|
|
|
Text { text: qsTr('Size: ') + content.size }
|
2011-12-07 03:03:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//![1]
|
|
|
|
//![2]
|
|
|
|
ListView {
|
|
|
|
id: view
|
|
|
|
|
2023-03-15 08:53:23 +00:00
|
|
|
anchors {
|
|
|
|
fill: parent
|
|
|
|
margins: 2
|
|
|
|
}
|
2011-12-07 03:03:08 +00:00
|
|
|
|
|
|
|
model: PetsModel {}
|
|
|
|
delegate: dragDelegate
|
|
|
|
|
|
|
|
spacing: 4
|
|
|
|
cacheBuffer: 50
|
|
|
|
}
|
|
|
|
//![2]
|
|
|
|
}
|
|
|
|
//![0]
|