Implemented combobox for device type register types
This commit is contained in:
@ -92,7 +92,12 @@ ColumnLayout {
|
|||||||
text: qsTr('Type:')
|
text: qsTr('Type:')
|
||||||
}
|
}
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
id: comboBox
|
||||||
|
model: deviceTypeRegisterTypesModel
|
||||||
|
textRole: "text"
|
||||||
|
valueRole: "value"
|
||||||
|
|
||||||
|
currentIndex: deviceTypesRegistersListView.currentData ? comboBox.indexOfValue(deviceTypesRegistersListView.currentData.registerType) : -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ ColumnLayout {
|
|||||||
model: deviceTypesModel
|
model: deviceTypesModel
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
valueRole: "id"
|
valueRole: "id"
|
||||||
currentIndex: deviceTypeCombobox.indexOfValue(listView.currentData.deviceTypeId)
|
currentIndex: listView.currentData ? deviceTypeCombobox.indexOfValue(listView.currentData.deviceTypeId) : -1
|
||||||
onCurrentValueChanged: if (listView.currentData) listView.currentData.deviceTypeId = currentValue; else console.warn('discarded');
|
onCurrentValueChanged: if (listView.currentData) listView.currentData.deviceTypeId = currentValue; else console.warn('discarded');
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Address:") }
|
Label { text: qsTr("Address:") }
|
||||||
|
@ -25,6 +25,17 @@ ApplicationWindow {
|
|||||||
controller: __controller
|
controller: __controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: deviceTypeRegisterTypesModel
|
||||||
|
ListElement { text: qsTr('Dimmer'); value: DeviceTypeRegisterType.Dimmer }
|
||||||
|
ListElement { text: qsTr('Red'); value: DeviceTypeRegisterType.Red }
|
||||||
|
ListElement { text: qsTr('Green'); value: DeviceTypeRegisterType.Green }
|
||||||
|
ListElement { text: qsTr('Blue'); value: DeviceTypeRegisterType.Blue }
|
||||||
|
ListElement { text: qsTr('White'); value: DeviceTypeRegisterType.White }
|
||||||
|
ListElement { text: qsTr('Strobo'); value: DeviceTypeRegisterType.Strobo }
|
||||||
|
ListElement { text: qsTr('Shutter'); value: DeviceTypeRegisterType.Shutter }
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
1
main.cpp
1
main.cpp
@ -47,7 +47,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
|
|
||||||
engine.rootContext()->setContextProperty("__controller", &controller);
|
engine.rootContext()->setContextProperty("__controller", &controller);
|
||||||
engine.rootContext()->setContextProperty("__windowed", windowed);
|
engine.rootContext()->setContextProperty("__windowed", windowed);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user