-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.qml
168 lines (152 loc) · 5.23 KB
/
models.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.1
Rectangle {
id:modelsRoot
color:"#76a5af"
width:dp(473)
height: dp(679)
visible: true
property var makeName
property var makeIMG
property var dataModels
ToolBarLayout{
id:toolbarLayout
color:"#76a5af"
height: dp(60)
width: parent.width
border.color:"#000000"
border.width: dp(2)
}
Rectangle {
id:subRectangle
anchors.top: toolbarLayout.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
color:"#45818e"
border.width: dp(1)
border.color:"black"
Rectangle{
id: makeImgName
height: dp(110)
anchors.left:parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: dp(10)
color: "transparent"
Image {
id:makeImg
width: dp(100)
height: dp(100)
anchors.left: parent.left
anchors.leftMargin: dp(20)
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source:makeIMG
}
Rectangle{
anchors.left: makeImg.right
anchors.right: parent.right
anchors.top:parent.top
anchors.bottom: parent.bottom
color: "transparent"
Text{
text: makeName
anchors.centerIn: parent
font.pixelSize: dp(32)
fontSizeMode: Text.Fit
font.bold: true
color:"white"
anchors.verticalCenter: makeImg.verticalCenter
}
}
}
Component.onCompleted: {
console.log("dataModels: ]",JSON.stringify(dataModels));
for(var i in dataModels.Model){
modelsModel.append({modelsName: i, carsNumber: dataModels.Model[i].length});
console.log("modelsName",i);
console.log("carsNumber: ",dataModels.Model[i].length);
}
}
ListModel { id: modelsModel }
ListView{
model: modelsModel
delegate: modelsDelagate
anchors.top: makeImgName.bottom
anchors.topMargin: dp(20)
anchors.bottom: parent.bottom
anchors.bottomMargin: dp(10)
anchors.left: parent.left
anchors.right: parent.right
spacing: dp(1)
clip: true
}
Component {
id:modelsDelagate
Rectangle {
id: modelsNameRec
width:dp(290)
height: dp(92)
color:"white"
anchors.right: parent.right
anchors.left: parent.left
Text {
text: modelsName
font.pixelSize: dp(18)
minimumPixelSize: dp(14)
fontSizeMode: Text.Fit
anchors.left: parent.left
anchors.leftMargin: dp(10)
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
id:carsNum
width: dp(20)
height: dp(20)
radius: dp(10)
color: "red"
anchors.right: rightArrow.left
anchors.rightMargin: dp(10)
anchors.verticalCenter: parent.verticalCenter
Text {
text: carsNumber
anchors.centerIn: parent
font.pixelSize: dp(14)
color: "white"
}
}
Image{
id:rightArrow
source: "/symbols/symbols/black-right-arrow.png"
width: dp(32)
height: dp(32)
anchors.right: parent.right
anchors.rightMargin: dp(5)
anchors.verticalCenter: parent.verticalCenter
mipmap: true
}
MouseArea {
anchors.fill: parent
onClicked: {
stackView.push ({item:Qt.resolvedUrl("carsPage.qml"),
properties: {
modelProperty: dataModels.Model[modelsName],
modelName: modelsName,
makeName: makeName,
makeIMG: makeIMG} })
// console.log("modelsName Length: ",modelsName.length);
}
}
}
}
}
/*
onDataModelsChanged: {
console.log('DatModels:', JSON.stringify(dataModels))
}*/
}