qmlFrontend/qml/qmlFrontend/HWComboBox.qml
author unc0rr
Thu, 26 Nov 2015 20:11:54 +0300
branchqmlfrontend
changeset 11432 97e3e62ea5f9
parent 11426 ab6a6d9ebfc0
permissions -rw-r--r--
Update seed, theme and script from net in UI
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10519
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     1
import QtQuick 2.0
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     2
import QtQuick.Window 2.1
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     3
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     4
HWButton {
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     5
    property alias model: itemsList.model
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     6
    property alias delegate: itemsList.delegate
10608
b85759f2ba18 Some more progress at custom combobox
unc0rr
parents: 10519
diff changeset
     7
    property alias currentIndex: itemsList.currentIndex
10519
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     8
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
     9
    Window {
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    10
        id: selection
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    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
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    14
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    15
        ListView {
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    16
            id: itemsList
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    17
            x: 0
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    18
            y: 64
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    19
            anchors.fill: parent
10610
eadf2cea55e0 Finish combobox implementation (except for visual part)
unc0rr
parents: 10608
diff changeset
    20
            anchors.bottomMargin: 32
10519
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    21
            highlight: Rectangle { color: "#eaea00"; radius: 4 }
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    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
ab6a6d9ebfc0 Small ui rework
unc0rr
parents: 10610
diff changeset
    53
            color: "#f3e520"
10519
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    54
        }
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    55
    }
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    56
11432
97e3e62ea5f9 Update seed, theme and script from net in UI
unc0rr
parents: 11426
diff changeset
    57
    function showItem(item) {
97e3e62ea5f9 Update seed, theme and script from net in UI
unc0rr
parents: 11426
diff changeset
    58
        cbIcon.source = item.iconSource
97e3e62ea5f9 Update seed, theme and script from net in UI
unc0rr
parents: 11426
diff changeset
    59
        cbText.text = item.text
97e3e62ea5f9 Update seed, theme and script from net in UI
unc0rr
parents: 11426
diff changeset
    60
    }
97e3e62ea5f9 Update seed, theme and script from net in UI
unc0rr
parents: 11426
diff changeset
    61
10519
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    62
    onClicked: selection.visibility = Window.Windowed
af019fa70080 Attempt on a custom combobox
unc0rr
parents:
diff changeset
    63
}