author | unc0rr |
Fri, 05 Jan 2018 21:44:00 +0100 | |
branch | qmlfrontend |
changeset 12878 | b3426030a426 |
parent 11432 | 97e3e62ea5f9 |
permissions | -rw-r--r-- |
10519 | 1 |
import QtQuick 2.0 |
2 |
import QtQuick.Window 2.1 |
|
3 |
||
4 |
HWButton { |
|
5 |
property alias model: itemsList.model |
|
6 |
property alias delegate: itemsList.delegate |
|
10608 | 7 |
property alias currentIndex: itemsList.currentIndex |
10519 | 8 |
|
9 |
Window { |
|
10 |
id: selection |
|
11 |
visibility: Window.Hidden |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
12 |
modality: Qt.WindowModal |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
13 |
flags: Qt.Dialog |
10519 | 14 |
|
15 |
ListView { |
|
16 |
id: itemsList |
|
17 |
x: 0 |
|
18 |
y: 64 |
|
19 |
anchors.fill: parent |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
20 |
anchors.bottomMargin: 32 |
10519 | 21 |
highlight: Rectangle { color: "#eaea00"; radius: 4 } |
22 |
focus: true |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
23 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
24 |
onCurrentItemChanged: { |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
25 |
cbIcon.source = currentItem.itemIconSource |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
26 |
cbText.text = currentItem.itemText |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
27 |
} |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
28 |
} |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
29 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
30 |
HWButton { |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
31 |
x: parent.width - 32 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
32 |
y: parent.height - 32 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
33 |
width: 32 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
34 |
height: 32 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
35 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
36 |
onClicked: selection.visibility = Window.Hidden; |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
37 |
} |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
38 |
} |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
39 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
40 |
Row { |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
41 |
anchors.fill: parent |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
42 |
anchors.margins: 4 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
43 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
44 |
Image { |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
45 |
id: cbIcon |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
46 |
width: height |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
47 |
height: parent.height |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
48 |
} |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
49 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
50 |
Text { |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
51 |
id: cbText |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
52 |
height: parent.height |
11426 | 53 |
color: "#f3e520" |
10519 | 54 |
} |
55 |
} |
|
56 |
||
11432 | 57 |
function showItem(item) { |
58 |
cbIcon.source = item.iconSource |
|
59 |
cbText.text = item.text |
|
60 |
} |
|
61 |
||
10519 | 62 |
onClicked: selection.visibility = Window.Windowed |
63 |
} |