-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.qml
More file actions
59 lines (55 loc) · 1.49 KB
/
main.qml
File metadata and controls
59 lines (55 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import QtQuick 2.7
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import ggh.model 1.0
Window {
id:root
visible: true
width: 1100
height: 480
title: qsTr("Hello World")
TestModel {id: mdl}
TreeView {
id: treeView
anchors.fill: parent
model: mdl
property var toMove: []
signal tryToMove()
onTryToMove: {
if (toMove.length == 2) {
mdl.moveRow(toMove[0], toMove[1])
toMove = []
}
}
TableViewColumn {
title: "title"
role: "display"
width: root.width
delegate: RowLayout {
Rectangle {
id: moveBtn
height: parent.height
Layout.preferredWidth: 40
color: "red"
radius: 5
border {
color: "black"
width: 2
}
MouseArea {
anchors.fill: parent
onClicked: {
treeView.toMove.push(styleData.index)
treeView.tryToMove()
}
}
}
Text {
Layout.fillWidth: true
text: styleData.value + " styleData.index: " + styleData.index
}
}
}
}
}