[SailfishDevel] PageStack: from push pushAttached directly to initialPage

Kimmo Lindholm Kimmo.Lindholm at eke.fi
Thu Sep 8 18:36:48 UTC 2016


Is this what you are looking for??


function getBottomPageId()
{
        return pageStack.find( function(page)
        {
            return (page._depth === 0)
        })
}

.... 

pageStack.pop(getBottomPageId(), PageStackAction.Immediate)
/* Remove all except bottom page, Thansk for Acce:
* https://together.jolla.com/question/44103/how-to-remove-all-except-bottom-page-from-pagestack/#post-id-44117
*/

.....

used e.g. here https://github.com/kimmoli/valuelogger/blob/master/qml/valuelogger.qml 

-kimmo

-----Original Message-----
From: Devel [mailto:devel-bounces at lists.sailfishos.org] On Behalf Of Andrey Kozhevnikov
Sent: 8. syyskuuta 2016 19:15
To: Sailfish OS Developers; devel at lists.sailfishos.org
Subject: Re: [SailfishDevel] PageStack: from push pushAttached directly to initialPage

for find function you might set objectName of your page

------ Исходное сообщение ------
От: "Michael Fuchs" <michfu at gmx.at>
Кому: devel at lists.sailfishos.org
Отправлено: 08.09.2016 22:52:09
Тема: Re: [SailfishDevel] PageStack: from push pushAttached directly to 
initialPage

>The find function looks promising.
>
>But where do I set the id of the mainPage, which is accessible via 
>pageStack?
>
>ApplicationWindow
>{
>     id: app
>     initialPage: Component { id: here?; TaskList { id:here?; } }
>
>}
>
>
>Am 08.09.2016 um 17:16 schrieb Andrey Kozhevnikov:
>>pageStack.pop(id of mainPage or page found using pageStack.find 
>>function)
>>
>>------ Исходное сообщение ------
>>От: "Michael Fuchs" <michfu at gmx.at>
>>Кому: devel at lists.sailfishos.org
>>Отправлено: 08.09.2016 19:39:39
>>Тема: Re: [SailfishDevel] PageStack: from push pushAttached directly 
>>to
>>initialPage
>>
>>>Thanks for your attention. ;)
>>>
>>>I guess I got it:
>>>
>>>onClicked: pageStack.replaceAbove(null, app.initialPage);
>>>
>>>...works for me.
>>>
>>>
>>>
>>>
>>>Am 08.09.2016 um 13:18 schrieb Michael Fuchs:
>>>>Hi guys,
>>>>
>>>>I got a question about the PageStack.
>>>>
>>>>I got a main page and a filter page, which can be push() 'ed or
>>>>pushAttached() several times. Either via PullDownMenu or swipe to 
>>>>left.
>>>>I would like to have another item in the pulldownmenu, which lets me
>>>>directly go back to the first page ("Back To FirstPage"), no matter 
>>>>how
>>>>the pages where added to the stack.
>>>>
>>>>Thanks a lot,
>>>>
>>>>Michael.
>>>>
>>>>
>>>>FirstPage.qml
>>>>==================
>>>>Page {
>>>>  ...
>>>>   PullDownMenu {
>>>>     MenuItem {
>>>>       text: qsTr("Filters")
>>>>       onClicked: pageStack.navigateForward();
>>>>     }
>>>>   }
>>>>   ...
>>>>   onStatusChanged: {
>>>>     if (status === PageStatus.Active && pageStack.depth === 1) {
>>>>       pageStack.pushAttached(Qt.resolvedUrl("Filters.qml"), {});
>>>>     }
>>>>   }
>>>>}
>>>>==================
>>>>
>>>>Filters.qml
>>>>==================
>>>>Page {
>>>>...
>>>>   PullDownMenu {
>>>>     MenuItem {
>>>>       text: qsTr("Specific Filters")
>>>>       onClicked: pageStack.push(Qt.resolvedUrl("Filters.qml"));
>>>>     }
>>>>     MenuItem {
>>>>       text: qsTr("More Filters")
>>>>       onClicked: pageStack.navigateForward();
>>>>     }
>>>>     MenuItem {
>>>>       text: qsTr("Back To FirstPage")
>>>>       onClicked: /*what to put here????*/;
>>>>     }
>>>>   }
>>>>...
>>>>   onStatusChanged: {
>>>>     if (status === PageStatus.Active && pageStack.depth === 1) {
>>>>       pageStack.pushAttached(Qt.resolvedUrl("Filters.qml"), {});
>>>>     }
>>>>   }
>>>>}
>>>>==================
>>>>
>>>>
>>>>_______________________________________________
>>>>SailfishOS.org Devel mailing list
>>>>To unsubscribe, please send a mail to
>>>>devel-unsubscribe at lists.sailfishos.org
>>>_______________________________________________
>>>SailfishOS.org Devel mailing list
>>>To unsubscribe, please send a mail to
>>>devel-unsubscribe at lists.sailfishos.org
>>
>>_______________________________________________
>>SailfishOS.org Devel mailing list
>>To unsubscribe, please send a mail to 
>>devel-unsubscribe at lists.sailfishos.org
>_______________________________________________
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to 
>devel-unsubscribe at lists.sailfishos.org

_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org


More information about the Devel mailing list