Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.2, 5.8.0
-
6cfeabe92db25a10812a657f7f4fdadfb505204d
Description
QQuickFlickable keeps track whether it's pressed or not. QQuickListView does not execute highlight move transitions on current index changes when it's pressed. When ListView is hid from a child's onDoubleClicked handler, it gets stuck in "pressed" state. When the ListView is shown again, highlight move transitions are not executed since it thinks it's still pressed.
Steps to reproduce:
- navigate with buttons or flicking -> works ok
- double click to hide the list view
- double click to show the list view
-> navigating with the buttons no longer works
-> flicking works, and fixes the internal state, and then the navigation buttons start working again
import QtQuick 2.6 import QtQuick.Window 2.2 Window { id: window width: 400 height: 600 visible: true title: listView.currentIndex MouseArea { anchors.fill: parent onDoubleClicked: listView.visible = true Text { anchors.margins: 20 anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: "<b>Double click to toggle visibility.</b><br/><br/>" + "After hiding and showing the view,<br/>the navigation buttons no longer work." } } ListView { id: listView anchors.fill: parent snapMode: ListView.SnapOneItem orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds preferredHighlightBegin: 0 preferredHighlightEnd: 0 highlightMoveDuration: 250 highlightRangeMode: ListView.StrictlyEnforceRange model: ["First", "Second", "Third"] delegate: Text { width: listView.width height: listView.height text: modelData horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter MouseArea { anchors.fill: parent onDoubleClicked: listView.visible = false } } onCurrentIndexChanged: console.log("ListView.currentIndex", currentIndex) } Text { text: "<" padding: 20 font.pixelSize: 36 anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter opacity: enabled ? 1 : 0.5 enabled: listView.visible && listView.currentIndex > 0 Rectangle { z: -1; border.color: "silver"; anchors.fill: parent } MouseArea { anchors.fill: parent onClicked: --listView.currentIndex } } Text { text: ">" padding: 20 font.pixelSize: 36 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter opacity: enabled ? 1 : 0.5 enabled: listView.visible && listView.currentIndex < listView.count - 1 Rectangle { z: -1; border.color: "silver"; anchors.fill: parent } MouseArea { anchors.fill: parent onClicked: ++listView.currentIndex } } }
Attachments
For Gerrit Dashboard: QTBUG-58453 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
183608,8 | Flickable: handle child mouse ungrab when hidden or disabled | 5.8 | qt/qtdeclarative | Status: MERGED | -2 | 0 |