From a7880a0c92323ccb2f297a39a993a87e20d65e9c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 1 Nov 2017 13:03:22 +0100 Subject: ListView: don't stop moving the highlight because of model updates In QQuickItemViewPrivate::applyModelChanges(), if moveReason = QQuickItemViewPrivate::Other, then QQuickItemView::trackedPositionChanged() will fail to call d->setPosition(pos), which is normally what keeps the Flickable moving for a while. Leave the reason as-is (it will be SetIndex in this case), so as not to forget that we were actually trying to move down. Updating the model was just a side-effect of that: either because some QML code was trying to append to the model or because fetchMore() was called. Task-number: QTBUG-61269 Task-number: QTBUG-62864 Change-Id: I3fd402469950d6c12e6a8d6e42be83ea4f54776a Reviewed-by: J-P Nurmi --- .../qquicklistview/data/appendDuringScrollDown.qml | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml (limited to 'tests/auto/quick/qquicklistview/data') diff --git a/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml new file mode 100644 index 0000000000..af35c29143 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml @@ -0,0 +1,28 @@ +import QtQuick 2.6 + +ListView { + width: 320; height: 240 + focus: true + delegate: Text { + height: 40; width: parent.width + text: model.text + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + highlight: Rectangle { color: "red" } + model: ListModel { + ListElement { text: "0" } + ListElement { text: "1" } + ListElement { text: "2" } + ListElement { text: "3" } + ListElement { text: "4" } + ListElement { text: "5" } + ListElement { text: "6" } + ListElement { text: "7" } + ListElement { text: "8" } + ListElement { text: "9" } + } + + readonly property Item topItem: itemAt(0, contentY) + onTopItemChanged: model.append({ "text": "new" }) +} -- cgit v1.2.3