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
|
id:timerLoader
|
||||||
interval: 500
|
interval: 500
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
print("AAAAAA")
|
|
||||||
pageLoaderCreate.source = "qrc:/qml/Create/Create.qml"
|
pageLoaderCreate.source = "qrc:/qml/Create/Create.qml"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,13 +140,8 @@ ApplicationWindow {
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
onStatusChanged: {
|
|
||||||
if(status == Loader.Ready){
|
|
||||||
pageLoaderWorkshop.source = "qrc:/qml/Workshop/Workshop.qml"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
Loader {
|
Loader {
|
||||||
id: pageLoaderWorkshop
|
id: pageLoaderWorkshop
|
||||||
visible: false
|
visible: false
|
||||||
@ -158,6 +152,22 @@ ApplicationWindow {
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
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 {
|
Connections {
|
||||||
target: pageLoader.item
|
target: pageLoader.item
|
||||||
@ -182,12 +192,6 @@ ApplicationWindow {
|
|||||||
nav.onPageChanged("Workshop")
|
nav.onPageChanged("Workshop")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onOpenCreate: {
|
|
||||||
if (!ignoreWorkshopBanner) {
|
|
||||||
nav.onPageChanged("Create")
|
|
||||||
ignoreWorkshopBanner = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sidebar {
|
Sidebar {
|
||||||
@ -209,6 +213,15 @@ ApplicationWindow {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
onChangePage: {
|
onChangePage: {
|
||||||
|
switchPage(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
onToggleMonitors: {
|
||||||
|
monitors.state = monitors.state == "active" ? "inactive" : "active"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchPage(name){
|
||||||
if(name === "Create"){
|
if(name === "Create"){
|
||||||
pageLoader.visible = false
|
pageLoader.visible = false
|
||||||
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
|
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
|
||||||
@ -228,12 +241,6 @@ ApplicationWindow {
|
|||||||
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
|
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
|
||||||
sidebar.state = "inactive"
|
sidebar.state = "inactive"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
onToggleMonitors: {
|
|
||||||
monitors.state = monitors.state == "active" ? "inactive" : "active"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitors {
|
Monitors {
|
||||||
|
Loading…
Reference in New Issue
Block a user