Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97252

Swipeview stops responding after right-clicking

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.7.1, 6.8.0 FF
    • 5.15.6, 6.7
    • Quick: Controls 2
    • 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

      1. Right-click on the "1" label
      2. Click on the "2" button at the top
      3. Notice that the page does not change
      4. Left-click anywhere in the SwipeView (red rectangle or "1" label)
      5. 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
                      }
                  }
              }
          }
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mhqanbari MohammadHossein Qanbari
            stcorp Peter Holleman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change