~mrp/aerodramus

eff88e9085d1780eb9722991a7d2fd5e24260fed — Mark Penner 7 months ago 5c2bd6f
reassign mainPage rather than pushing more pages
1 files changed, 17 insertions(+), 5 deletions(-)

M src/qml/main.qml
M src/qml/main.qml => src/qml/main.qml +17 -5
@@ 12,6 12,7 @@ import mrp.aerodramus

Kirigami.ApplicationWindow {
    id: root
    property Kirigami.Page mainPage
    title: i18nc("@title:window", "Aerodramus")
    visible: true
    minimumHeight: 600


@@ 37,7 38,7 @@ Kirigami.ApplicationWindow {
        id: openDialog
        fileMode: FileDialog.OpenFile
        currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
        onAccepted: pageStack.push("qrc:/qml/AudioFile.qml", {fileName: selectedFile})
        onAccepted: openFilePage(selectedFile)
    }

    globalDrawer: Kirigami.GlobalDrawer {


@@ 48,16 49,27 @@ Kirigami.ApplicationWindow {
        ]
    }

    pageStack.initialPage: [navPage, mainPage]
    pageStack.initialPage: navPage
    Kirigami.ScrollablePage {
        id: navPage
        ListView {
            id: listView
            model: 10
            Kirigami.PlaceholderMessage {
                anchors.centerIn: parent
                width: parent.width - (Kirigami.Units.largeSpacing * 4)
                visible: listView.count === 0
                text: i18n("No views yet")
                helpfulAction: openAction
            }
            model: 0
            delegate: QQC.Label{text: model.index}
        }
    }
    Kirigami.ScrollablePage {
        id: mainPage
    function openFilePage(fileUrl) {
        if (pageStack.depth >= 2) {
            pageStack.currentIndex = 1;
            pageStack.pop();
        }
        root.mainPage = pageStack.push("qrc:/qml/AudioFile.qml", {fileName: fileUrl});
    }
}