Finish combobox implementation (except for visual part) qmlfrontend
authorunc0rr
Wed, 03 Dec 2014 23:36:18 +0300
branchqmlfrontend
changeset 10610 eadf2cea55e0
parent 10608 b85759f2ba18
child 10612 eb3c1a289a23
Finish combobox implementation (except for visual part)
qmlFrontend/qml/qmlFrontend/GameConfig.qml
qmlFrontend/qml/qmlFrontend/HWComboBox.qml
--- a/qmlFrontend/qml/qmlFrontend/GameConfig.qml	Wed Dec 03 00:20:21 2014 +0300
+++ b/qmlFrontend/qml/qmlFrontend/GameConfig.qml	Wed Dec 03 23:36:18 2014 +0300
@@ -39,20 +39,25 @@
 
     HWComboBox {
         id: cbTheme
-        x: 320
-        y: 16
-        width: 100
-        height: 256
+        x: 50
+        y: 160
+        width: 256
+        height: 64
 
         model: themesModel
         delegate: Rectangle {
             height: 25
             width: 100
             color: "transparent"
+
+            property alias itemIconSource: themeIcon.source
+            property alias itemText: themeName.text
+
             Row {
-                Image {width: height; height: parent.height; source: "image://theme/" + modelData}
+                Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData}
                 Text {id: themeName; text: modelData }
             }
+
             MouseArea {
                  z: 1
                  anchors.fill: parent
--- a/qmlFrontend/qml/qmlFrontend/HWComboBox.qml	Wed Dec 03 00:20:21 2014 +0300
+++ b/qmlFrontend/qml/qmlFrontend/HWComboBox.qml	Wed Dec 03 23:36:18 2014 +0300
@@ -9,14 +9,47 @@
     Window {
         id: selection
         visibility: Window.Hidden
+        modality: Qt.WindowModal
+        flags: Qt.Dialog
 
         ListView {
             id: itemsList
             x: 0
             y: 64
             anchors.fill: parent
+            anchors.bottomMargin: 32
             highlight: Rectangle { color: "#eaea00"; radius: 4 }
             focus: true
+
+            onCurrentItemChanged: {
+                cbIcon.source = currentItem.itemIconSource
+                cbText.text = currentItem.itemText
+            }
+        }
+
+        HWButton {
+            x: parent.width - 32
+            y: parent.height - 32
+            width: 32
+            height: 32
+
+            onClicked: selection.visibility = Window.Hidden;
+        }
+    }
+
+    Row {
+        anchors.fill: parent
+        anchors.margins: 4
+
+        Image {
+            id: cbIcon
+            width: height
+            height: parent.height
+        }
+
+        Text {
+            id: cbText
+            height: parent.height
         }
     }