Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.6
-
None
Description
I'm trying to create a SwipeView where the first page has the interactive property false, while the others have it enabled. The effect that I'm trying to achieve is to have the main page with a link to the others, but the others can only go back to the main page (like the iOS settings menu).
The issue is that after the first change page, the currentIndex the property loses binding causing the SwipeView to break.
Here's the application output:
qrc:/main.qml:10:5: QML SwipeView: Binding loop detected for property "currentIndex" file:///home/rcc/Qt/5.12.6/gcc_64/qml/QtQuick/Controls.2/SwipeView.qml:49:18: QML ListView: Binding loop detected for property "currentIndex"
and here's the default swipe view application (QtCreator -> New Project -> Qt Quick Application - Swipe) main.qml:
import QtQuick 2.12 import QtQuick.Controls 2.5 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Tabs") SwipeView { id: swipeView anchors.fill: parent currentIndex: tabBar.currentIndex interactive: false onCurrentIndexChanged: { if (currentIndex === 0) { interactive = false } else { interactive = true } } Rectangle { color: "red" opacity: 0.5 } Rectangle { color: "green" opacity: 0.5 } } footer: TabBar { id: tabBar currentIndex: swipeView.currentIndex TabButton { text: qsTr("Page 1") } TabButton { text: qsTr("Page 2") } } }
To reproduce the bug:
- Click on Page 2.
- Swipe left.
- Click again on Page 2.