Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.12.3
-
None
Description
import QtQuick 2.12 import QtQuick.Controls 2.5 Item { id: root width: 600 height: 600 ListView { id: list anchors.fill: parent clip: true anchors.margins: 100 model: 20 spacing: 20 currentIndex: button.index preferredHighlightBegin: height / 2 - 50 preferredHighlightEnd: preferredHighlightBegin + 100 highlightRangeMode: ListView.StrictlyEnforceRange onMovementStarted: timer.stop onMovementEnded: timer.start() onCurrentIndexChanged: console.warn("CurrentIndex", currentIndex) delegate: Rectangle { width: parent.width height: 100 color: "green" Text { anchors.centerIn: parent text: index font.pixelSize: 50 } } } Button { id: button property int index: 5 onClicked: index = (index + 1) % 20 text: index font.pixelSize: 50 } Timer { id: timer interval: 2000 onTriggered: { console.warn("triggered") list.currentIndex = Qt.binding(function(){return button.index}) } } }
The list.currentIndex is binding to button.index. The user can interact with the ListView, but after 2000 ms, it should return to the button.index. But if during a call _list.currentIndex = Qt.binding(function()
{return button.index})_ the user press on the ListView and does not move the mouse, the currentIndex will change but the ListView will not scroll to the currentIndex. And after that I can’t determine when the user released the mouse and the call _list.currentIndex = Qt.binding(function(){return button.index})_ will not have any results. Could you add a pressed property to Flickable?
So that I can use it like that:
ListView { ... onPressedChanged: { if (pressed) timer.stop() else timer.start() } }
Or maybe you can offer another solution to this problem?
Attachments
Issue Links
- resulted from
-
QT3DS-3308 Support customer project X
-
- In Progress
-
- mentioned in
-
Page Loading...