Attempt on a custom combobox qmlfrontend
authorunc0rr
Sat, 22 Nov 2014 00:55:01 +0300
branchqmlfrontend
changeset 10519 af019fa70080
parent 10517 844bd43db47a
child 10606 8e95911cb86b
Attempt on a custom combobox
qmlFrontend/qml/qmlFrontend/GameConfig.qml
qmlFrontend/qml/qmlFrontend/HWComboBox.qml
qmlFrontend/qmlFrontend.pro
--- a/qmlFrontend/qml/qmlFrontend/GameConfig.qml	Wed Nov 19 00:38:14 2014 +0300
+++ b/qmlFrontend/qml/qmlFrontend/GameConfig.qml	Sat Nov 22 00:55:01 2014 +0300
@@ -37,7 +37,31 @@
         onClicked: HWEngine.runLocalGame()
     }
 
-    Rectangle {
+    HWComboBox {
+        x: 320
+        y: 16
+        width: 100
+        height: 256
+
+        model: themesModel
+        delegate: Rectangle {
+            height: 25
+            width: 100
+            color: "transparent"
+            Text {id: themeName; text: modelData }
+            MouseArea {
+                 z: 1
+                 anchors.fill: parent
+                 onClicked: {
+                     themeImage.source = "image://theme/" + themeName.text
+                     model.currentIndex = index
+                     HWEngine.setTheme(themeName.text)
+                 }
+            }
+        }
+    }
+
+/*    Rectangle {
         x: 320
         y: 16
         width: 100
@@ -54,34 +78,7 @@
             height: 64
             fillMode: Image.Pad
         }
-
-        ListView {
-            id: themesList
-            x: 0
-            y: 64
-            width: 100
-            height: 192
-            highlight: Rectangle { color: "#eaea00"; radius: 4 }
-            focus: true
-
-            model: themesModel
-            delegate: Rectangle {
-                height: 25
-                width: 100
-                color: "transparent"
-                Text {id: themeName; text: modelData }
-                MouseArea {
-                     z: 1
-                     anchors.fill: parent
-                     onClicked: {
-                         themeImage.source = "image://theme/" + themeName.text
-                         themesList.currentIndex = index
-                         HWEngine.setTheme(themeName.text)
-                     }
-                }
-            }
-        }
-    }
+*/
 
     ListView {
         id: playingTeamsList
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlFrontend/qml/qmlFrontend/HWComboBox.qml	Sat Nov 22 00:55:01 2014 +0300
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+import QtQuick.Window 2.1
+
+HWButton {
+    property alias model: itemsList.model
+    property alias delegate: itemsList.delegate
+
+    Window {
+        id: selection
+        visibility: Window.Hidden
+
+        ListView {
+            id: itemsList
+            x: 0
+            y: 64
+            anchors.fill: parent
+            highlight: Rectangle { color: "#eaea00"; radius: 4 }
+            focus: true
+        }
+    }
+
+    onClicked: selection.visibility = Window.Windowed
+}
--- a/qmlFrontend/qmlFrontend.pro	Wed Nov 19 00:38:14 2014 +0300
+++ b/qmlFrontend/qmlFrontend.pro	Sat Nov 22 00:55:01 2014 +0300
@@ -37,4 +37,5 @@
     qml/qmlFrontend/main.qml \
     qml/qmlFrontend/LocalGame.qml \
     qml/qmlFrontend/GameConfig.qml \
-    qml/qmlFrontend/First.qml
+    qml/qmlFrontend/First.qml \
+    qml/qmlFrontend/HWComboBox.qml