diff --git a/HomeForm.qml b/HomeForm.qml index 29d484b..4d8b3a6 100644 --- a/HomeForm.qml +++ b/HomeForm.qml @@ -5,7 +5,7 @@ Page { title: qsTr("Home") Label { - text: qsTr("You are on the home page.") + text: qsTr("You are on the home page. " + settings.serviceUrl) anchors.centerIn: parent } } diff --git a/SettingsForm.qml b/SettingsForm.qml index ee384c9..c926550 100644 --- a/SettingsForm.qml +++ b/SettingsForm.qml @@ -2,10 +2,56 @@ import QtQuick 2.0 import QtQuick.Controls 2.2 Page { + id: root + title: qsTr("Settings") - Label { - text: qsTr("You are on Settings Page") - anchors.centerIn: parent + ListModel { + id: settingsModel + + ListElement { + name: "serviceUrl" + title: qsTr("NooLite service URL:") + inputHint: Qt.ImhUrlCharactersOnly + } + } + + ListView { + model: settingsModel + + anchors.fill: parent + anchors.margins: 8 + + delegate: Item { + id: settingsItem + + width: parent.width + height: childrenRect.height + + Label { + id: titleLabel + + anchors.left: settingsItem.left + anchors.verticalCenter: valueField.verticalCenter + + text: model.title + } + + TextField { + id: valueField + + anchors.right: settingsItem.right + anchors.left: titleLabel.right + anchors.leftMargin: 8 + + inputMethodHints: model.inputHint + + text: settings[model.name] + + onTextChanged: { + settings[model.name] = text + } + } + } } } diff --git a/main.qml b/main.qml index 392db4a..027061a 100644 --- a/main.qml +++ b/main.qml @@ -1,13 +1,21 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 +import Qt.labs.settings 1.0 ApplicationWindow { id: window + visible: true width: 640 height: 480 title: qsTr("Stack") + Settings { + id: settings + + property string serviceUrl: "" + } + header: ToolBar { contentHeight: 36