Re: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ?
Yes. My soution predates that. You should use StackLayout. Sent: Saturday, February 24, 2018 at 4:15 AM From: "jack ma" <assang...@gmail.com> To: "Jason H" <jh...@gmx.com> Cc: "Fabrice Salvaire" <fabrice.salva...@orange.fr>, interest <interest@qt-project.org> Subject: Re: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ? It seems that StackView instantiate QML components when push and destroy it when pop, so we cann't get information from previous page. what we should use is StackLayout ? 2018-02-24 11:06 GMT+08:00 Jason H <jh...@gmx.com>: I would certainly hope so as I've written apps to dynamically manage the stackview and any user using the app for a few iterations would likely run out of memory. Note that memory mangement in QML is voodoo, and as a result, the actual destruction is not deterministic. If you need to access popped items, then StackView is not for you What I did to accomplish a wizard was very simply to create an item containing my various screens, with a single button bar at the bottom, then make property var pages: [page1, page2, page3] property currentPageIndex function setCurrentPageIndex(page) { prevButton.visible = page > 0 nextButton.visible = page > pages.length-1 for (i=0;i<pages.length; i++) pages[i].visible = page ==i onCurrentPageIndexChanged: setCurrentPageIndex(currentPageIndex) then on your nextButton: currentPageIndex++; prevButton: currentPageIndex--; Sent: Friday, February 23, 2018 at 4:58 PM From: "Fabrice Salvaire" <fabrice.salva...@orange.fr> To: interest@qt-project.org Subject: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ? Dear all, I am experimenting a way to implement a wizard interface featuring a next and previous page navigation using QtQuick Controls 2. I tried to achieve this using StackView but I receive the error "TypeError: Type error' when I try to access popped items later, for example using console.info(popped_item_array) It looks like a kind of garbage collection of the Qt object returned by push and pop. But I could not figure out any explanation of this behaviour on the Qt doc https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-controls2-stackview.html However the older implementation had a destroyOnPop feature cf. http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html Cheers, Fabrice ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ?
Am 24.02.18 um 10:15 schrieb jack ma: > It seems that StackView instantiate QML components when push and > destroy it when pop, so we cann't get information from previous page. you have access to the Page before it will be destroyed. All my Pages have a name property so I can check which Page it is per ex: // StackView function popOnePage() { var page = pop() if(page.name === "MyAddressPage") { // access to properties var d = page.theCity // access to functions var x = page.getData() return } } ekke ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ?
It seems that StackView instantiate QML components when push and destroy it when pop, so we cann't get information from previous page. what we should use is StackLayout ? 2018-02-24 11:06 GMT+08:00 Jason H <jh...@gmx.com>: > I would certainly hope so as I've written apps to dynamically manage the > stackview and any user using the app for a few iterations would likely run > out of memory. > > Note that memory mangement in QML is voodoo, and as a result, the actual > destruction is not deterministic. If you need to access popped items, then > StackView is not for you > > What I did to accomplish a wizard was very simply to create an item > containing my various screens, with a single button bar at the bottom, then > make > property var pages: [page1, page2, page3] > property currentPageIndex > > function setCurrentPageIndex(page) { > prevButton.visible = page > 0 > nextButton.visible = page > pages.length-1 > for (i=0;i<pages.length; i++) >pages[i].visible = page ==i > > onCurrentPageIndexChanged: setCurrentPageIndex(currentPageIndex) > > then on your nextButton: > currentPageIndex++; > > prevButton: > currentPageIndex--; > > > > *Sent:* Friday, February 23, 2018 at 4:58 PM > *From:* "Fabrice Salvaire" <fabrice.salva...@orange.fr> > *To:* interest@qt-project.org > *Subject:* [Interest] QtQuick Controls2 : Does StackView garbage collect > popped items ? > > Dear all, > > I am experimenting a way to implement a wizard interface featuring a next > and previous page navigation using QtQuick Controls 2. > > I tried to achieve this using StackView but I receive the error > "TypeError: Type error' when I try to access popped items later, for > example using console.info(popped_item_array) > > It looks like a kind of garbage collection of the Qt object returned by > push and pop. But I could not figure out any explanation of this behaviour > on the Qt doc https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick- > controls2-stackview.html > <https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-controls2-stackview.html#unwinding-items-via-pop> > However the older implementation had a destroyOnPop feature cf. > http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html > > Cheers, > > Fabrice > > > ___ Interest mailing list > Interest@qt-project.org http://lists.qt-project.org/ > mailman/listinfo/interest > > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > > ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ?
I would certainly hope so as I've written apps to dynamically manage the stackview and any user using the app for a few iterations would likely run out of memory. Note that memory mangement in QML is voodoo, and as a result, the actual destruction is not deterministic. If you need to access popped items, then StackView is not for you What I did to accomplish a wizard was very simply to create an item containing my various screens, with a single button bar at the bottom, then make property var pages: [page1, page2, page3] property currentPageIndex function setCurrentPageIndex(page) { prevButton.visible = page > 0 nextButton.visible = page > pages.length-1 for (i=0;i<pages.length; i++) pages[i].visible = page ==i onCurrentPageIndexChanged: setCurrentPageIndex(currentPageIndex) then on your nextButton: currentPageIndex++; prevButton: currentPageIndex--; Sent: Friday, February 23, 2018 at 4:58 PM From: "Fabrice Salvaire" <fabrice.salva...@orange.fr> To: interest@qt-project.org Subject: [Interest] QtQuick Controls2 : Does StackView garbage collect popped items ? Dear all, I am experimenting a way to implement a wizard interface featuring a next and previous page navigation using QtQuick Controls 2. I tried to achieve this using StackView but I receive the error "TypeError: Type error' when I try to access popped items later, for example using console.info(popped_item_array) It looks like a kind of garbage collection of the Qt object returned by push and pop. But I could not figure out any explanation of this behaviour on the Qt doc https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-controls2-stackview.html However the older implementation had a destroyOnPop feature cf. http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html Cheers, Fabrice ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QtQuick Controls2 : Does StackView garbage collect popped items ?
Dear all, I am experimenting a way to implement a wizard interface featuring a next and previous page navigation using QtQuick Controls 2. I tried to achieve this using StackView but I receive the error "TypeError: Type error' when I try to access popped items later, for example using console.info(popped_item_array) It looks like a kind of garbage collection of the Qt object returned by push and pop. But I could not figure out any explanation of this behaviour on the Qt doc https://doc-snapshots.qt.io/qt5-5.11/qml-qtquick-controls2-stackview.html However the older implementation had a destroyOnPop feature cf. http://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html Cheers, Fabrice ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest