-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeView.qml
210 lines (174 loc) · 6.64 KB
/
HomeView.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import QtQuick 2.9
import QtQuick.Window 2.12
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.3
import QtQuick.Layouts 1.3
import Models 1.0
Item {
property var nameWindow: 'Home'
property var stack
property var numberOfColumns: 2
property var numberOfColumnsAux: 0
property var isGrid: true
property var itemWidth: 110
property var gridElem: grid
property var notaTable
property var marcadorTable
property var toolbar
property var markersModel
property var markersListView
property var filter
signal changeIsGrid(bool toList);
anchors.fill: parent
Component.onCompleted: {
if(markersModel !== undefined)
markersModel.clear();
//markersModel.append({'nome':''});
}
GridView{
id:grid
anchors.fill: parent
anchors.leftMargin: 10 - (isGrid)
anchors.topMargin: 10
ScrollBar.vertical: ScrollBar {
visible: true
}
cellWidth: ((parent.width / numberOfColumns ) - 10/numberOfColumns)
cellHeight: 120
model:notaTable
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onWidthChanged: {
if(isGrid){
if(width <= 500){
numberOfColumns = 2;
}else if(width <= 650){
numberOfColumns = 3;
}else if(width <= 1050){
numberOfColumns = 5;
}else{
numberOfColumns = 7
}
}else{
numberOfColumns = 1;
}
}
delegate: Column{
property var notaID: id
function search(text){
if(text === undefined || text.trim().length === 0)
return true;
text = text.trim().toLowerCase();
return (titulo.trim().toLowerCase().includes(text)
|| desc.trim().toLowerCase().includes(text)
|| cor.trim().toLowerCase().includes(text)
|| date.trim().toLowerCase().includes(text)
)
}
opacity: search(filter) ? 1 : 0.2
Card{
id:card
elevation: 10
width: grid.cellWidth - 10
height: grid.cellHeight - 10
cardColor: (cor.trim() == Material.background) ? Material.foreground : cor
//borderColor: (cor.trim() == Material.background)? Material.accent : 'transparent'
clip: true
MouseArea{
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
toolbar.date = date;
toolbar.idOfItem = id;
markersModel.clear();
markersModel.append({'nome':''});
stack.push('AdicionarNotaView.qml', {"idOfItem": id, "marcadorTable" : marcadorTable,"markersListView":markersListView, "markersModel":markersModel, "titulo": titulo, "desc":desc, "cor":cor, "date":date});
}
}
Label{
id:lbTitle
width: parent.width
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
clip: true
elide: "ElideRight"
color: "black"
text: titulo
}
Rectangle{
id:titleSeparator
anchors.top: lbTitle.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 5
anchors.leftMargin: 10
anchors.rightMargin: 10
width: parent.width
height: 1
color: Material.background
opacity: Material.theme == Material.Light? 0.4 : 0.2
}
Label{
width: parent.width
anchors.top: titleSeparator.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
clip: true
wrapMode: "NoWrap"
font.pixelSize: 13
elide: "ElideRight"
color: "black"
text: desc
}
Item {
anchors.bottom: parent.bottom
anchors.left: parent.left
width: parent.width
height: 20
anchors.bottomMargin: 2
anchors.leftMargin: 10
RowLayout{
spacing: 12
Layout.fillWidth: true
Repeater{
model: marcadorTable
delegate:
Label{
visible: nota_id == notaID
id:mc
text: nome
color:"black"
font.pixelSize: 10
Rectangle{
radius:10
anchors.centerIn: parent
width: mc.width + 10
height: mc.height + 5
color: "#FFFFAA"
z: -1
}
}
// Rectangle{
// visible: nota_id == notaID
// width: 50
// height: mc.width
// radius:10
// color: "#FFFFAA"
// Label{
// id:mc
// anchors.centerIn: parent
// text: nome
// color:"black"
// font.pixelSize: 10
// }
// }
}
}
}
}
}
}
}