Better restructuring of QML files

This commit is contained in:
2023-02-19 21:22:45 +01:00
parent 9edce9bee4
commit 2461e00c73
10 changed files with 290 additions and 153 deletions

View File

@ -21,9 +21,12 @@ ColumnLayout {
Layout.maximumWidth: 300
Layout.fillHeight: true
model: devicesModel
model: DevicesModel {
id: model
controller: __controller
}
onAddClicked: (index) => { const newIndex = index < 0 ? 0 : index + 1; if (devicesModel.insertRow(newIndex)) currentIndex = newIndex; else console.warn('failed'); }
onAddClicked: (index) => { const newIndex = index < 0 ? 0 : index + 1; if (model.insertRow(newIndex)) currentIndex = newIndex; else console.warn('failed'); }
onRemoveClicked: (index) => {
const dialog = dialogComponent.createObject(Overlay.overlay);
dialog.index = index;
@ -43,7 +46,7 @@ ColumnLayout {
modal: true
title: qsTr('Confirmation')
onAccepted: devicesModel.removeRow(index)
onAccepted: model.removeRow(index)
Label {
id: textContainer