-
Notifications
You must be signed in to change notification settings - Fork 0
/
GroupsSearch.qml
109 lines (93 loc) · 2.85 KB
/
GroupsSearch.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
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
Item {
property bool sorting: true
property string column
property string name
property string search
objectName: "groupsSearch"
function interpret(number, factor, unit) {
if (number == 0) {
return "";
}
factor = typeof factor !== 'undefined' ? factor : 1;
if (isNaN(number)) {
if (number[0] == '<') {
number = number[0] + " " + (parseFloat(number.slice(1, number.length)) * factor).toLocaleString(Qt.locale()) + " " + unit;
}
return number;
}
else {
return (parseFloat(number) * factor).toLocaleString(Qt.locale()) + " " + unit;
}
}
function sizeBg(number, factor, rdi) {
if (rdi == 0) {
return 0;
}
factor = typeof factor !== 'undefined' ? factor : 1;
if (isNaN(number)) {
if (number[0] == '<') {
number = (parseFloat(number.slice(1, number.length)) * factor) / rdi;
return number;
}
return 0;
}
else {
return (parseFloat(number) * factor) / rdi;
}
}
function refresh() {
groupsFilterModel.setParameter(":group", "'%" + column + "%'");
groupsFilterModel.setParameter(":searchString", "'%" + search + "%'");
groupsFilterModel.setParameter(":sorting", sorting ? "ASC" : "DESC");
groupsFilterModel.refresh();
}
Component {
id: resultsDelegate
Item {
anchors {
right: parent.right
left: parent.left
}
height: 60
ColumnLayout {
anchors.fill: parent
Text {
text: origfdnm
Layout.alignment: Qt.AlignBottom | Qt.AlignLeft
Layout.leftMargin: 16
opacity: 1
elide: Text.ElideRight
Layout.maximumWidth: parent.width * 0.7
font.pixelSize: 13
}
Text {
text: origgpfr
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.leftMargin: 16
opacity: 0.535
font.pixelSize: 13
}
}
MouseArea {
anchors.fill: parent
onClicked: {
createProductPage(false, origfdcd, null);
}
}
}
}
ListView {
id: resultsView
anchors.fill: parent
model: groupsFilterModel
delegate: resultsDelegate
clip: true
onMovementStarted: {
searchField.focus = false;
}
ScrollBar.vertical: ScrollBar {}
}
}