Add settings for device type registers
This commit is contained in:
@@ -14,7 +14,7 @@ ColumnLayout {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
EditableListView {
|
EditableListView {
|
||||||
id: listView
|
id: deviceTypesListView
|
||||||
|
|
||||||
Layout.preferredWidth: 300
|
Layout.preferredWidth: 300
|
||||||
Layout.maximumWidth: 300
|
Layout.maximumWidth: 300
|
||||||
@@ -27,39 +27,80 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
enabled: listView.currentIndex !== -1
|
enabled: deviceTypesListView.currentIndex !== -1
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
Layout.preferredWidth: 300
|
Layout.preferredWidth: 600
|
||||||
Layout.maximumWidth: 300
|
Layout.maximumWidth: 600
|
||||||
|
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
Label { text: qsTr("Id:") }
|
Label { text: qsTr("Id:") }
|
||||||
SpinBox {
|
SpinBox {
|
||||||
|
enabled: false
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
value: listView.currentData.id
|
value: deviceTypesListView.currentData.id
|
||||||
onValueModified: listView.currentData.id = value
|
onValueModified: deviceTypesListView.currentData.id = value
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Name:") }
|
Label { text: qsTr("Name:") }
|
||||||
TextField {
|
TextField {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: listView.currentData.name
|
text: deviceTypesListView.currentData.name
|
||||||
onTextEdited: listView.currentData.name = text
|
onTextEdited: deviceTypesListView.currentData.name = text
|
||||||
}
|
}
|
||||||
Label { text: qsTr("Registers:") }
|
Label { text: qsTr("Registers:") }
|
||||||
Pane {
|
Pane {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
EditableListView {
|
|
||||||
textRole: 'registerTypeName'
|
|
||||||
|
|
||||||
model: DeviceTypeRegistersModel {
|
Material.elevation: 6
|
||||||
controller: __controller
|
|
||||||
deviceTypeId: listView.currentData.id
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Pane {
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Material.elevation: 6
|
||||||
|
|
||||||
|
EditableListView {
|
||||||
|
id: deviceTypesRegistersListView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
textRole: 'registerTypeName'
|
||||||
|
|
||||||
|
model: DeviceTypeRegistersModel {
|
||||||
|
controller: __controller
|
||||||
|
deviceTypeId: deviceTypesListView.currentData.id
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
enabled: deviceTypesRegistersListView.currentIndex >= 0
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
columns: 2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr('Type:')
|
||||||
|
}
|
||||||
|
ComboBox {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ ColumnLayout {
|
|||||||
onAddClicked: (index) => devicesModel.insertRow(index < 0 ? 0 : index + 1);
|
onAddClicked: (index) => devicesModel.insertRow(index < 0 ? 0 : index + 1);
|
||||||
onRemoveClicked: (index) => devicesModel.removeRow(index)
|
onRemoveClicked: (index) => devicesModel.removeRow(index)
|
||||||
|
|
||||||
onCurrentDataChanged: test.value = currentData.position
|
onCurrentDataChanged: if (currentData) test.value = currentData.position
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@@ -37,6 +37,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
Label { text: qsTr("Id:") }
|
Label { text: qsTr("Id:") }
|
||||||
SpinBox {
|
SpinBox {
|
||||||
|
enabled: false
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
value: listView.currentData.id
|
value: listView.currentData.id
|
||||||
onValueModified: listView.currentData.id = value
|
onValueModified: listView.currentData.id = value
|
||||||
|
@@ -27,7 +27,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Remove")
|
text: qsTr("Remove ") + listView.currentIndex
|
||||||
|
|
||||||
onClicked: removeClicked(listView.currentIndex)
|
onClicked: removeClicked(listView.currentIndex)
|
||||||
enabled: listView.currentIndex >= 0
|
enabled: listView.currentIndex >= 0
|
||||||
@@ -42,6 +42,8 @@ ColumnLayout {
|
|||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
onCountChanged: if (count === 0 && currentIndex >= 0) currentIndex = -1
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
property variant myData: model
|
property variant myData: model
|
||||||
readonly property bool isCurrentItem: ListView.isCurrentItem
|
readonly property bool isCurrentItem: ListView.isCurrentItem
|
||||||
|
Reference in New Issue
Block a user