-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRAMView.qml
More file actions
126 lines (116 loc) · 3.38 KB
/
RAMView.qml
File metadata and controls
126 lines (116 loc) · 3.38 KB
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
import QtQuick 2.5
import QtQuick.Controls 1.5
Item {
id: item1
width: 300
height: 512
property alias button1: button1
property alias button2: button2
property alias button3: button3
property alias textField1: textField1
property var rAMmodel
property int activeIndex: 0
property int fpIndex: -1
property int spIndex: -1
property int lastactiveIndex: 0
onActiveIndexChanged: {
if(activeIndex > -1) {
listView1.positionViewAtIndex(activeIndex, ListView.Contain);
lastactiveIndex = activeIndex;
} else {
listView1.positionViewAtIndex(lastactiveIndex, ListView.Contain);
}
}
TextField {
id: textField1
text: ""
anchors.bottom: button2.top
anchors.bottomMargin: 5
anchors.top: parent.top
anchors.topMargin: 0
anchors.right: button1.left
anchors.rightMargin: 5
anchors.left: parent.left
anchors.leftMargin: 3
placeholderText: qsTr("Address")
}
Button {
id: button1
x: 174
width: 105
height: 22
text: qsTr("Go")
anchors.right: parent.right
anchors.rightMargin: 3
anchors.top: parent.top
anchors.topMargin: 0
}
ListView {
id: listView1
anchors.right: parent.right
anchors.rightMargin: 3
anchors.left: parent.left
anchors.leftMargin: 3
anchors.bottom: button3.top
anchors.bottomMargin: 5
anchors.top: button2.bottom
anchors.topMargin: 5
boundsBehavior: Flickable.StopAtBounds
clip: true
currentIndex: 0
focus: true
z: -1
model: rAMmodel
onModelChanged: {
if(activeIndex > -1) {
listView1.positionViewAtIndex(activeIndex, ListView.Contain);
lastactiveIndex = activeIndex;
} else {
listView1.positionViewAtIndex(lastactiveIndex, ListView.Contain);
}
}
delegate: MouseArea {
id: wrapper
height: 20
width: parent.width
onClicked: {
listView1.currentIndex = index
listView1.focus = true
textField1.focus = false
}
Rectangle{
color: index == item1.activeIndex ? "#ff4444" : (index == item1.fpIndex ? "#AA00FF" : (index == item1.spIndex ? "#00D500" : (index % 2 == 0 ? "#B7F7FD" : "#B7E3FD")))
anchors.fill: parent
Text {
text: modelData
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.bold: index == item1.activeIndex
}
}
}
}
Button {
id: button2
text: qsTr("<<<")
anchors.top: button1.bottom
anchors.topMargin: 5
anchors.left: parent.left
anchors.leftMargin: 3
anchors.right: parent.right
anchors.rightMargin: 3
}
Button {
id: button3
x: -3
y: -8
text: qsTr(">>>")
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.rightMargin: 3
anchors.left: parent.left
anchors.leftMargin: 3
anchors.right: parent.right
}
}