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

Right click on SwipeView can cause setCurrentIndex no longer update the view

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6, 6.7
    • None
    • Tested on both Linux and Windows, using Qt 6.6 and Qt 6.7. The current dev branch is also tested and can confirm to reproduce the issue.
    • All

    Description

      Steps to reproduce:

      1. Save the following code as `Main.qml`
      2. Use the `qml` executable to view this file by executing: `qml Main.qml`
      3. Click the PageIndicator dots on the bottom of the window, you can see the SwipeView will set to the corresponding page (top-left corner shows the index of the current page, and there is also a debug text in the center of the window, shows the current index of the view and the page indicator), so far it works as intended
      4. Use mouse and right click on the SwipeView
      5. Repeat step 3, you will notice the top-left corner no longer match the actual current index, which is the bug.
      6. Use mouse drag the swipe view to swipe the page, after that, everything goes back to normal again.

      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Test bug")
      
          SwipeView {
              id: view
              anchors.fill: parent
              // currentIndex: indicator.currentIndex
              Repeater {
                  model: 6
                  Text {
                      text: index
                      font.pointSize: 30
                  }
              }
          }
      
          PageIndicator {
              id: indicator
      
              interactive: true
              count: view.count
              currentIndex: view.currentIndex
      
              onCurrentIndexChanged: () => {
                  view.setCurrentIndex(currentIndex)
                  // debug purpose
                  let debugText = `current index changed to ${currentIndex}, view.currentIndex: ${view.currentIndex}`
                  text.text = debugText
                  console.log(debugText)
              }
      
              anchors.bottom: view.bottom
              anchors.horizontalCenter: parent.horizontalCenter
          }
          // for debug purpose
          Text {
              id: text
              anchors.fill: parent
              horizontalAlignment: Text.AlignHCenter
              verticalAlignment: Text.AlignVCenter
          }
      }
      

      Let me know if you need any additional information.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            blumia Gary Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes