Qt World Summit: Register Today!

Listview index increments on screen rotation

  • Hi,

    Anyone encountered this issue? Any advise?

    Here is the sample ListView

      ListView {
        id: wizardList
        property int delegateArea
        anchors.fill: parent
        focus: true
        boundsBehavior: Flickable.StopAtBounds
        highlightRangeMode: ListView.StrictlyEnforceRange
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem
        cacheBuffer: delegateArea
        //model: wizardModel
       delegate: WizardDelegate {
          Component.onCompleted: {
            wizardList.delegateArea = width * height;
    1. Flick the ListView to show item 2
    2. Rotate the screen from portrait to landscape
    3. item 2 is still the visible item
    4. Rotate again the screen from landscape to portrait
    5. The visible item is now item 3
      Once you repeat the process, step 5 always increments the index.

    I tried setting the cacheBuffer into 0, they same results when running the steps above.
    However, when I tried to flick back after the index increments, it won't increment anymore when changing orientation.

    Setting cacheBuffer to 0 it will affect the smothness when flicking items.


  • I found this the same issue before but it was tagged as out of scope. :(

    https://bugreports.qt.io/browse/QTBUG-20332?jql=text ~ "listview screen rotation"

    There's a comment stating that this works in QtQuick 2 however from my end it is still happening.

    Am i the only one experiencing this?

  • I'm facing same issue and its still reproducible in Qt 5.5.0 Android. I think it is reproduced when we do some heavy operations inside list delgate.

  • Lifetime Qt Champion

    HI guys,

    If you are still experiencing the behavior with Qt Quick 2 then please open a new report with a minimal compilable example that shows the behavior.

    However, you should first test it against the latest version of Qt. Currently 5.7

Log in to reply