| 1 |
// Copyright (C) 2025 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick |
| 5 |
import QtQuick.Controls |
| 6 |
import QtQuick.Layouts |
| 7 |
|
| 8 |
Rectangle { |
| 9 |
id: root |
| 10 |
visible: true |
| 11 |
width: 1200 |
| 12 |
height: 500 |
| 13 |
|
| 14 |
property AbstractItemModel model |
| 15 |
|
| 16 |
RowLayout { |
| 17 |
anchors.fill: parent |
| 18 |
ListView { |
| 19 |
id: list |
| 20 |
implicitWidth: 500 |
| 21 |
implicitHeight: 500 |
| 22 |
model: root.model |
| 23 |
delegateModelAccess: DelegateModel.ReadWrite |
| 24 |
delegate: RowLayout { |
| 25 |
id: delegate |
| 26 |
width: ListView.view.width |
| 27 |
required property string display |
| 28 |
required property int row |
| 29 |
required property int column |
| 30 |
required property int index |
| 31 |
required property var modelData |
| 32 |
required property var model |
| 33 |
Text { |
| 34 |
text: delegate.display |
| 35 |
Layout.preferredWidth: 50 |
| 36 |
MouseArea { |
| 37 |
anchors.fill: parent |
| 38 |
hoverEnabled: true |
| 39 |
ToolTip.visible: containsMouse |
| 40 |
ToolTip.text: delegate.modelData + " (" + delegate.model + ")" |
| 41 |
onClicked: !isNaN(delegate.display) ? ++delegate.display |
| 42 |
: delegate.display += "!" |
| 43 |
} |
| 44 |
} |
| 45 |
Text { |
| 46 |
Layout.preferredWidth: 30 |
| 47 |
text: delegate.index + ": " + delegate.row + "/" + delegate.column |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
TableView { |
| 53 |
id: table |
| 54 |
implicitWidth: 200 |
| 55 |
implicitHeight: 500 |
| 56 |
model: root.model |
| 57 |
alternatingRows: true |
| 58 |
rowSpacing: 5 |
| 59 |
columnSpacing: 5 |
| 60 |
clip: true |
| 61 |
selectionModel: ItemSelectionModel {} |
| 62 |
delegate: TableViewDelegate { |
| 63 |
implicitWidth: 50 |
| 64 |
implicitHeight: 20 |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
TreeView { |
| 69 |
id: treeView |
| 70 |
implicitWidth: 500 |
| 71 |
implicitHeight: 500 |
| 72 |
clip: true |
| 73 |
selectionModel: ItemSelectionModel {} |
| 74 |
model: root.model |
| 75 |
|
| 76 |
delegate: TreeViewDelegate {} |
| 77 |
} |
| 78 |
} |
| 79 |
} |