mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 11:32:42 +01:00
Refactored nav switch into function
This commit is contained in:
parent
a24fbdd315
commit
f329929200
43
main.qml
43
main.qml
@ -125,7 +125,6 @@ ApplicationWindow {
|
||||
id:timerLoader
|
||||
interval: 500
|
||||
onTriggered: {
|
||||
print("AAAAAA")
|
||||
pageLoaderCreate.source = "qrc:/qml/Create/Create.qml"
|
||||
}
|
||||
|
||||
@ -141,13 +140,8 @@ ApplicationWindow {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
onStatusChanged: {
|
||||
if(status == Loader.Ready){
|
||||
pageLoaderWorkshop.source = "qrc:/qml/Workshop/Workshop.qml"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: pageLoaderWorkshop
|
||||
visible: false
|
||||
@ -158,6 +152,22 @@ ApplicationWindow {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
onStatusChanged: {
|
||||
if(status == Loader.Ready){
|
||||
connectionsPageLoaderWorkshop.target = pageLoaderWorkshop
|
||||
}
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
id:connectionsPageLoaderWorkshop
|
||||
ignoreUnknownSignals: true
|
||||
onOpenCreate: {
|
||||
print("lellele")
|
||||
if (!ignoreWorkshopBanner) {
|
||||
switchPage("Workshop")
|
||||
ignoreWorkshopBanner = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: pageLoader.item
|
||||
@ -182,12 +192,6 @@ ApplicationWindow {
|
||||
nav.onPageChanged("Workshop")
|
||||
}
|
||||
}
|
||||
onOpenCreate: {
|
||||
if (!ignoreWorkshopBanner) {
|
||||
nav.onPageChanged("Create")
|
||||
ignoreWorkshopBanner = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar {
|
||||
@ -209,6 +213,15 @@ ApplicationWindow {
|
||||
left: parent.left
|
||||
}
|
||||
onChangePage: {
|
||||
switchPage(name)
|
||||
}
|
||||
|
||||
onToggleMonitors: {
|
||||
monitors.state = monitors.state == "active" ? "inactive" : "active"
|
||||
}
|
||||
}
|
||||
|
||||
function switchPage(name){
|
||||
if(name === "Create"){
|
||||
pageLoader.visible = false
|
||||
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
|
||||
@ -228,12 +241,6 @@ ApplicationWindow {
|
||||
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
|
||||
sidebar.state = "inactive"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onToggleMonitors: {
|
||||
monitors.state = monitors.state == "active" ? "inactive" : "active"
|
||||
}
|
||||
}
|
||||
|
||||
Monitors {
|
||||
|
Loading…
Reference in New Issue
Block a user