-
Notifications
You must be signed in to change notification settings - Fork 2
/
FileDelegate.qml
145 lines (139 loc) · 4.1 KB
/
FileDelegate.qml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import QtQuick 2.0
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.14
Item {
width: filelist.width
height: 50
Rectangle {
id: delegatebackground
anchors.centerIn: parent
width: parent.width
// width: 0
height: 48
// color: "#039BE5"
}
Rectangle {
// color: "#039BE5"
color: "transparent"
width: parent.width
height: 48
anchors.left: parent.left
anchors.leftMargin: 20
radius: 10
RowLayout {
anchors.fill: parent
anchors.leftMargin: 15
spacing: 15
// Text {
// Layout.preferredWidth: 15
// color: "#616161"
// text: "\uf15b"
// font.family: "fontello"
// font.pixelSize: 20
// }
CheckBox {
id: checkbox
Layout.preferredWidth: 15
Layout.rightMargin: -15
// checked: true
}
Text {
id: fname
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 30
color: "#616161"
text: model.filename
font.pixelSize: 15
}
Text {
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 15
color: "#616161"
text: model.size
font.pixelSize: 15
}
Text {
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 10
color: "#616161"
text: model.type
font.pixelSize: 15
}
Text {
Layout.alignment: Qt.AlignVCenter
Layout.preferredWidth: 15
color: "#616161"
text: model.mimetype
font.pixelSize: 15
}
}
states: [
State {
name: "choosed"
PropertyChanges {
target: delegatebackground
// color: "#D32F2F"
color: "#039BE5"
}
PropertyChanges {
target: delegatebackground
width: parent.width
}
PropertyChanges {
target: delegatebackground
opacity: 0.5
}
},
State {
name: "not-choosed"
PropertyChanges {
target: delegatebackground
color: "transparent"
}
}
]
transitions: [
Transition {
from: "not-choosed"
to: "choosed"
ColorAnimation {
// from: "white"
// to: "black"
duration: 200
}
PropertyAnimation {
// target: delegatebackground
property: "width"
from: 0
duration: 150
easing: Easing.OutQuart
}
},
Transition {
from: "choosed"
to: "not-choosed"
ColorAnimation {
target: delegatebackground
duration: 200
easing: Easing.OutQuart
}
// PropertyAnimation {
//// target: delegatebackground
// property: "width"
// duration: 200
//// easing:
// }
}
]
state: checkbox.checked ? "choosed" : "not-choosed"
onStateChanged: {
if (state == "choosed") {
filelist.fileIndex.push(index)
filelist.removeMode = true
return
}
filelist.fileIndex.splice(filelist.fileIndex.indexOf(index), 1)
filelist.removeMode = fileIndex.length > 0 ? true : false
}
}
}