mirror of
https://github.com/overte-org/overte.git
synced 2025-04-24 21:55:53 +02:00
Get ComboBox working
This commit is contained in:
parent
829c858b04
commit
98ad785267
2 changed files with 35 additions and 14 deletions
|
@ -12,18 +12,26 @@ import QtQuick 2.5
|
|||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import "../styles-uit"
|
||||
import "../controls-uit" as HifiControls
|
||||
import "." as VrControls
|
||||
|
||||
FocusScope {
|
||||
id: root
|
||||
|
||||
property alias model: comboBox.model;
|
||||
property alias comboBox: comboBox
|
||||
readonly property alias currentText: comboBox.currentText;
|
||||
property alias currentIndex: comboBox.currentIndex;
|
||||
|
||||
property int colorScheme: hifi.colorSchemes.light
|
||||
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
|
||||
property string label: ""
|
||||
property real controlHeight: height + (comboBoxLabel.visible ? comboBoxLabel.height + comboBoxLabel.anchors.bottomMargin : 0)
|
||||
|
||||
implicitHeight: comboBox.height;
|
||||
focus: true
|
||||
|
||||
readonly property ComboBox control: comboBox
|
||||
|
||||
Rectangle {
|
||||
id: background
|
||||
gradient: Gradient {
|
||||
|
@ -61,9 +69,10 @@ FocusScope {
|
|||
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
|
||||
width: 20
|
||||
height: textField.height
|
||||
VrControls.FontAwesome {
|
||||
anchors.centerIn: parent; size: 16;
|
||||
text: "\uf0d7"
|
||||
HiFiGlyphs {
|
||||
anchors.centerIn: parent
|
||||
size: hifi.dimensions.spinnerSize
|
||||
text: hifi.glyphs.caratDn
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,4 +166,13 @@ FocusScope {
|
|||
}
|
||||
}
|
||||
|
||||
HifiControls.Label {
|
||||
id: comboBoxLabel
|
||||
text: root.label
|
||||
colorScheme: root.colorScheme
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: 4
|
||||
visible: label != ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,30 +10,33 @@
|
|||
|
||||
import QtQuick 2.5
|
||||
|
||||
import "../../controls-uit"
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "../../controls-uit" as HiFiControls
|
||||
import "../../styles-uit"
|
||||
|
||||
Preference {
|
||||
id: root
|
||||
property alias comboBox: comboBox
|
||||
height: comboBox.controlHeight
|
||||
height: dataComboBox.controlHeight
|
||||
|
||||
Component.onCompleted: {
|
||||
comboBox.currentIndex = comboBox.find(preference.value);
|
||||
dataComboBox.currentIndex = dataComboBox.comboBox.find(preference.value);
|
||||
}
|
||||
|
||||
function save() {
|
||||
preference.value = comboBox.currentText;
|
||||
preference.value = dataComboBox.currentText;
|
||||
//preference.value = comboBox.currentText;
|
||||
preference.save();
|
||||
}
|
||||
|
||||
Label {
|
||||
HiFiControls.Label {
|
||||
text: root.label + ":"
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
anchors.verticalCenter: comboBox.verticalCenter
|
||||
anchors.verticalCenter: dataComboBox.verticalCenter
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: comboBox
|
||||
HiFiControls.ComboBox {
|
||||
id: dataComboBox
|
||||
model: preference.items
|
||||
width: 150
|
||||
anchors { right: parent.right }
|
||||
|
|
Loading…
Reference in a new issue