diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-11-01 13:03:22 +0100 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2017-11-03 08:27:29 +0000 |
commit | a7880a0c92323ccb2f297a39a993a87e20d65e9c (patch) | |
tree | 64002c86e06fd5a1c8fc8a5532c3d2f26eb32346 /tests/auto/quick/qquicklistview/data | |
parent | eb2265d4c89b64c571f276e628b751abac29f895 (diff) |
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 <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/data')
-rw-r--r-- | tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml | 28 |
1 files changed, 28 insertions, 0 deletions
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" }) +} |