65 lines
1.5 KiB
QML
65 lines
1.5 KiB
QML
import QtQuick 2.0
|
|
import QtQuick.Controls 2.2
|
|
|
|
Page {
|
|
id: root
|
|
|
|
title: qsTr("Settings")
|
|
|
|
ListModel {
|
|
id: settingsModel
|
|
|
|
ListElement {
|
|
name: "serviceUrl"
|
|
title: qsTr("nooLite service URL")
|
|
inputMethodHint: Qt.ImhUrlCharactersOnly
|
|
}
|
|
}
|
|
|
|
ListView {
|
|
model: settingsModel
|
|
|
|
anchors.fill: parent
|
|
|
|
delegate: SubtitledItemDelegate {
|
|
width: parent.width
|
|
text: model.title
|
|
subtitle: settings[model.name]
|
|
|
|
onClicked: inputDialog.open()
|
|
|
|
Dialog {
|
|
id: inputDialog
|
|
|
|
x: (parent.width - width) / 2
|
|
y: (parent.height - height) / 2
|
|
parent: ApplicationWindow.overlay
|
|
|
|
focus: true
|
|
modal: true
|
|
title: model.title
|
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
|
|
|
Column {
|
|
spacing: 20
|
|
anchors.fill: parent
|
|
|
|
TextField {
|
|
id: textField
|
|
|
|
width: parent.width
|
|
focus: true
|
|
inputMethodHints: Qt.ImhNoAutoUppercase | model.inputMethodHint
|
|
placeholderText: model.title
|
|
text: settings[model.name]
|
|
}
|
|
}
|
|
|
|
onAccepted: {
|
|
settings[model.name] = textField.text
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|