QML SwipeView Signals
-
wrote on 14 Jun 2016, 19:34 last edited by zeroc8
Hi, is there any signal I can connect to when a SwipeView Page gets loaded?
SwipeView { // this doesn't work // onChanged: { console.log('page changed'); } Page { // this doesn't work // onLoaded: { console.log('page loaded'); } } Page { } Page { } }
-
Hi, is there any signal I can connect to when a SwipeView Page gets loaded?
SwipeView { // this doesn't work // onChanged: { console.log('page changed'); } Page { // this doesn't work // onLoaded: { console.log('page loaded'); } } Page { } Page { } }
wrote on 14 Jun 2016, 19:44 last edited byHi! You can use
onCurrentIndexChanged
:SwipeView { id: view anchors.fill: parent currentIndex: 1 onCurrentIndexChanged: console.log(currentIndex) Rectangle { color: "red" width: 300 height: 400 } Rectangle { color: "green" width: 300 height: 400 } Rectangle { color: "blue" width: 300 height: 400 } }
-
wrote on 14 Jun 2016, 21:16 last edited by
Perhaps the SwipeView.isCurrentItem attached property is of use for you?
SwipeView { Rectangle { color: SwipeView.isCurrentItem ? "red" : "green" } }
-
Hi! You can use
onCurrentIndexChanged
:SwipeView { id: view anchors.fill: parent currentIndex: 1 onCurrentIndexChanged: console.log(currentIndex) Rectangle { color: "red" width: 300 height: 400 } Rectangle { color: "green" width: 300 height: 400 } Rectangle { color: "blue" width: 300 height: 400 } }
wrote on 15 Jun 2016, 06:35 last edited by@Wieland Thankyou, that works. It seems that signal is missing from the documentation that comes with QtCreator.
-
@Wieland Thankyou, that works. It seems that signal is missing from the documentation that comes with QtCreator.
wrote on 15 Jun 2016, 06:58 last edited byProperty Change Signal Handlers:
http://doc.qt.io/qt-5/qtqml-syntax-signals.html#property-change-signal-handlers
1/5