Qt Quick Controls: currentIndex won't change if model is statically generated on Tumbler + workaround

After a long time I reported a bug to Qt as I found quite unexpected bug from Qt Quick. On Qt Quick Controls 2, if you set model statically in Tumbler component(e.g. model: [2, 4, 6, 7, 10]), everything is shown properly but currentIndex doesn't change at all. For example, even though the screen shows the fifth item, currentIndex is still 0, and onCurrentIndexChanged event doesn't fire at all.

To work around this bug, you may just set a model "dynamically" like as follows:

Components.onCompleted: {

    // do something
    model=[ 1, 2, 3, 4, 5 ] 
    // do something more
}

My check indicates this bug existed since Qt 5.12 or earlier, but nobody seems to have reported this, though I think there must be people using Tumbler like I do...... Well, maybe everyone was too lazy to write a report.

Anyway I reported the bug, and got ticket number QTBUG-85933.

https://bugreports.qt.io/browse/QTBUG-85933

I hope that the bug can be fixed sooner.

No comments:

Post a Comment

블로그를 이전합니다

뭐, 이런 작은 변방의 블로그에 관심있으신 분들은 아무도 없으시리라 생각합니다만...... (웃음) 블로그 플랫폼을 블로거에서 dev.to로 옮겼습니다. 새 URL은 아래와 같습니다: https://dev.to/teminian 새로운 거처에서 뵙겠습니...

Popular in Code{nested}