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

Tumbler without wrap ignores initial currentIndex

    XMLWordPrintable

Details

    • 1fe83c1fd3eb9abfd13a7b8c7adb2c2355d8ad4d (qt/qtquickcontrols2/dev) 44f37f37f6a21db4d9d8e10735203d485924a5da (qt/qtquickcontrols2/6.0) 536cdf48327eefc831b84b314b7088055576d211 (qt/tqtc-qtquickcontrols2/tqtc/lts-5.15)

    Description

      Attached example sets tumbler to 0 index always. Following output is found with debug category enabled:

      qt.quick.controls.tumbler: setting wrap to false - exlicit? true
      qt.quick.controls.tumbler: setting currentIndex to -1, old currentIndex was -1, changeReason is "InternalChange"
      qt.quick.controls.tumbler: setting currentIndex to 5, old currentIndex was -1, changeReason is "UserChange"
      qt.quick.controls.tumbler: we're not complete; setting pendingCurrentIndex instead
      qt.quick.controls.tumbler: setting pendingCurrentIndex to 5
      qt.quick.controls.tumbler: componentComplete()
      qt.quick.controls.tumbler: emitting wrapChanged() to force view to be created
      qt.quick.controls.tumbler: view count changed - ignoring signals? true
      qt.quick.controls.tumbler: view currentIndex changed to "5", but we're ignoring it because one or more of the following conditions are true:
      - !view: false
      - ignoreCurrentIndexChanges: true
      - currentIndexSetDuringModelChange: false
      qt.quick.controls.tumbler: setting pendingCurrentIndex to -1
      qt.quick.controls.tumbler: view count changed - ignoring signals? false
      qt.quick.controls.tumbler: setting count to 20, old count was 0
      qt.quick.controls.tumbler: setting currentIndex to 0, old currentIndex was -1, changeReason is "InternalChange"
      qt.quick.controls.tumbler: view currentIndex changed to "0", but we're ignoring it because one or more of the following conditions are true:
      - !view: false
      - ignoreCurrentIndexChanges: true
      - currentIndexSetDuringModelChange: false
      qml: onCurrentIndexChanged 0
      qt.quick.controls.tumbler: view's currentIndex is now 0 and ours is 0
      qt.quick.controls.tumbler: componentComplete() is done
      
      import QtQuick 2.12
      import QtQuick.Controls 2.12
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          Rectangle {
              width: 640
              height: 400
      
              Tumbler {
                  id: amPmTumbler
                  x: 290
                  y: 90
                  width: 60
                  height: 238
      
                  Rectangle {
                      anchors.fill: parent
                      color: "transparent"
                      border.color: "black"
                  }
      
                  model: 20
                  currentIndex: 5
                  onCurrentIndexChanged: {
                      console.debug("onCurrentIndexChanged " + currentIndex)
                  }
                  wrap: false
      
                  delegate: Text {
                      horizontalAlignment: Text.AlignHCenter
                      verticalAlignment: Text.AlignVCenter
      
                      text: modelData
                  }
              }
          }
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-84426
        # Subject Branch Project Status CR V

        Activity

          People

            semlanik Alexey Edelev
            poikelin Joni Poikelin
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes