Files
scheincommander/DevicesSettingsPage.qml
T

80 lines
2.6 KiB
QML
Raw Normal View History

2023-02-15 01:12:19 +01:00
import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
ColumnLayout {
Label {
text: qsTr("Devices Settings")
}
RowLayout {
//Layout.fillWidth: true
Layout.fillHeight: true
EditableListView {
id: listView
Layout.preferredWidth: 300
Layout.maximumWidth: 300
Layout.fillHeight: true
model: devicesModel
onAddClicked: (index) => devicesModel.insertRow(index < 0 ? 0 : index + 1);
2023-02-15 01:12:19 +01:00
onRemoveClicked: (index) => devicesModel.removeRow(index)
2023-02-15 20:17:58 +01:00
2023-02-15 22:27:57 +01:00
onCurrentDataChanged: if (currentData) test.value = currentData.position
2023-02-15 01:12:19 +01:00
}
ColumnLayout {
enabled: listView.currentIndex !== -1
2023-02-15 01:12:19 +01:00
GridLayout {
Layout.preferredWidth: 300
Layout.maximumWidth: 300
columns: 2
Label { text: qsTr("Id:") }
SpinBox {
2023-02-15 22:27:57 +01:00
enabled: false
2023-02-15 01:12:19 +01:00
Layout.fillWidth: true
value: listView.currentData.id
onValueModified: listView.currentData.id = value
2023-02-15 01:12:19 +01:00
}
Label { text: qsTr("Name:") }
TextField {
Layout.fillWidth: true
text: listView.currentData.name
onTextEdited: listView.currentData.name = text
2023-02-15 01:12:19 +01:00
}
Label { text: qsTr("DeviceType:") }
ComboBox {
2023-02-15 22:45:18 +01:00
id: deviceTypeCombobox
2023-02-15 01:12:19 +01:00
Layout.fillWidth: true
model: deviceTypesModel
textRole: "name"
valueRole: "id"
2023-02-15 22:45:18 +01:00
currentIndex: deviceTypeCombobox.indexOfValue(listView.currentData.deviceTypeId)
onCurrentValueChanged: if (listView.currentData) listView.currentData.deviceTypeId = currentValue; else console.warn('discarded');
2023-02-15 01:12:19 +01:00
}
Label { text: qsTr("Address:") }
SpinBox {
Layout.fillWidth: true
value: listView.currentData.address
onValueModified: listView.currentData.address = value
2023-02-15 01:12:19 +01:00
}
Label { text: qsTr("Position:") }
2023-02-15 20:17:58 +01:00
Vector3DField {
id: test
Layout.fillWidth: true
onValueModified: listView.currentData.position = value;
2023-02-15 20:17:58 +01:00
// TODO solve without onCurrentDataChanged
}
2023-02-15 01:12:19 +01:00
}
Item {
Layout.fillHeight: true
}
}
}
}