blob: c7482a31386b618ebef38ebe0011d20fcc6c05d8 (
plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.4
ListView {
currentIndex: -1
id: list_view1
anchors.fill: parent
focus: true
section.criteria: ViewSection.FirstCharacter
section.property: "fullName"
section.delegate : Rectangle {
height: childrenRect.height
gradient: Gradient {
GradientStop {
position: 0
color: "#5ca4fb"
}
GradientStop {
position: 1
color: "#2d548b"
}
}
width: parent.width
Text {
x: 12
color: "#ffffff"
text: section
style: Text.Raised
font.pixelSize: 18
font.bold: true
}
}
delegate: Item {
clip: true
state: ListView.isCurrentItem ? "expanded" : "collapsed"
id: delegate
x: 5
height: 50
width: parent.width
Behavior on height {
PropertyAnimation {
}
}
Column {
id: column1
height: 400
width: parent.width - 20
spacing: 4
Row {
id: row1
spacing: 10
Image {
source: "dummy.png"
}
Text {
text: fullName
font.pointSize: 16
anchors.verticalCenter: parent.verticalCenter
font.bold: true
}
}
Grid {
opacity: delegate.state === "expanded" ? 1 : 0
Behavior on opacity {
PropertyAnimation {
}
}
x: 60
spacing: 10
columns: 2
Text {
text: qsTr("Address:")
font.bold: true
font.pixelSize: 16
}
Text {
text: address
font.pixelSize: 16
font.bold: true
}
Text {
text: qsTr("City:")
font.pixelSize: 16
font.bold: true
}
Text {
text: city
font.pixelSize: 16
font.bold: true
}
Text {
text: qsTr("Number:")
font.pixelSize: 16
font.bold: true
}
Text {
text: number
font.pixelSize: 16
font.bold: true
}
}
Rectangle {
opacity: delegate.state === "expanded" ? 1 : 0
Behavior on opacity {
PropertyAnimation {
}
}
height: 1
color: "#828181"
anchors.right: parent.right
anchors.rightMargin: 4
anchors.left: parent.left
anchors.leftMargin: 4
}
}
MouseArea {
anchors.fill: parent
onClicked: {
if (delegate.ListView.view.currentIndex == index)
delegate.ListView.view.currentIndex = -1;
else
delegate.ListView.view.currentIndex = index;
}
}
states: [
State {
name: "collapsed"
},
State {
name: "expanded"
PropertyChanges {
target: delegate
height: 160
}
}
]
}
}
|