Добавил сервисную страницу, небольшой рефакторинг
This commit is contained in:
36
main.qml
36
main.qml
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user