Добавил сервисную страницу, небольшой рефакторинг

This commit is contained in:
2018-08-14 20:24:20 +02:00
parent b6001e4e81
commit 76786176d2
6 changed files with 89 additions and 21 deletions

View File

@@ -16,6 +16,14 @@ ApplicationWindow {
property string serviceUrl: ""
}
LightsModel {
id: lightsModel
serviceUrl: settings.serviceUrl
onError: stackView.showError(text)
}
header: ToolBar {
contentHeight: 36
@@ -72,16 +80,19 @@ ApplicationWindow {
}
}
ItemDelegate {
text: qsTr("Service")
width: parent.width
onClicked: {
stackView.openPage("ServiceForm.qml")
}
}
ItemDelegate {
text: qsTr("Settings")
width: parent.width
onClicked: {
if (stackView.depth > 1) {
stackView.pop()
}
stackView.push("SettingsForm.qml")
drawer.close()
stackView.openPage("SettingsForm.qml")
}
}
}
@@ -91,6 +102,19 @@ ApplicationWindow {
id: stackView
initialItem: "HomeForm.qml"
anchors.fill: parent
function openPage(page) {
if (depth > 1) {
pop()
}
push(page)
drawer.close()
}
function showError(text) {
ToolTip.show(text, 1000)
}
}
onClosing: {