Models registry was added

This commit is contained in:
2023-04-11 09:42:27 +02:00
parent 4a52926be9
commit 4ed4ecd429
17 changed files with 183 additions and 91 deletions

View File

@@ -26,13 +26,23 @@ Page {
width: parent.width
text: model.title
subtitle: settingsService[model.name]
subtitle: model.subtitle || ""
function valueAccepted() {
model.value = editor.value
}
function disconnectDialog() {
inputDialog.accepted.disconnect(valueAccepted)
}
onClicked: {
inputDialog.title = model.title
inputDialog.name = model.name
inputDialog.control = controls[model.control]
inputDialog.initialValue = model.value
inputDialog.choiceModel = model.choiceModel
inputDialog.accepted.connect(valueAccepted)
inputDialog.closed.connect(disconnectDialog)
inputDialog.open()
}
}
@@ -41,8 +51,8 @@ Page {
Dialog {
id: inputDialog
property string name: ""
property var choiceModel: undefined
property var initialValue: undefined
property alias control: editor.sourceComponent
width: root.width * 0.8
@@ -60,10 +70,6 @@ Page {
anchors.fill: parent
}
onAccepted: {
settingsService[inputDialog.name] = editor.value
}
}
Component {
@@ -72,10 +78,10 @@ Page {
TextField {
id: textField
property alias value: textField.text
property string value: text
inputMethodHints: Qt.ImhNoAutoUppercase
text: settingsService[inputDialog.name] || ""
text: inputDialog.initialValue || ""
}
}
@@ -97,7 +103,7 @@ Page {
property var valueId: modelData.id
text: modelData.name
width: parent.width
checked: settingsService[inputDialog.name] === valueId
checked: inputDialog.initialValue === valueId
ButtonGroup.group: group
}
}