Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15.6, 6.7
-
None
-
25099f84c (dev), 74bc2f9d1 (6.7), 73eeb35f0 (tqtc/lts-5.15)
Description
When right-clicking on certain elements inside a SwipeView, changing the currentIndex will not result in the content being displayed being changed. If you left click somewhere inside the SwipeView, normal behavior is restored. This can also be reproduced by middle-clicking instead of right-clicking.
When the SwipeView is set to be non-interactive, this bug does not occur.
I have attached an example QML file. To reproduce the bug, do the following
- Right-click on the "1" label
- Click on the "2" button at the top
- Notice that the page does not change
- Left-click anywhere in the SwipeView (red rectangle or "1" label)
- Click on the "2" button at the top and the page will change as expected
Some interesting observation:
- Right-clicking on the red rectangle on page 1 will not cause any issues, only clicking on the "1" label causes issues
- The currentIndex is changing when the buttons are being pressed, even in the bug situation, but the content doesn't change
- Changing pages by swiping still works, but changing pages by setting currentIndex breaks
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 ApplicationWindow { id: window width: 640 height: 480 visible: true title: qsTr("Swipe") ColumnLayout { anchors.fill: parent RowLayout { Layout.alignment: Qt.AlignHCenter Button { text: "1" checked: stackView.currentIndex===0 onClicked: stackView.currentIndex=0 autoExclusive: true } Button { text: "2" checked: stackView.currentIndex===1 onClicked: stackView.currentIndex=1 autoExclusive: true } } SwipeView { id: stackView Layout.fillHeight: true Layout.fillWidth: true interactive: true onCurrentIndexChanged: console.log(currentIndex) Item { Rectangle { anchors.fill: parent color: "red" } Rectangle { anchors.fill: label1 color: 'white' } Label { id: label1 text: '1' anchors.centerIn: parent } } Item { Label { text: '2' anchors.centerIn: parent } } } } }