Revert "Fix ListView.isCurrentItem when used with DelegateModel"
This reverts commit d9f9d773e9
.
It causes a heap-use-after-free in tst_swipeview.qml.
Task-number: QTBUG-97423
Pick-to: 5.15 6.1 6.2
Change-Id: I42e9831ae1399a010df28c39496a7778121f5e35
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
This commit is contained in:
parent
716aa78818
commit
5d656b31eb
|
@ -2402,8 +2402,6 @@ void QQuickItemView::createdItem(int index, QObject* object)
|
|||
d->repositionPackageItemAt(item, index);
|
||||
else if (index == d->currentIndex)
|
||||
d->updateCurrent(index);
|
||||
} else if (index == d->currentIndex) {
|
||||
d->updateCurrent(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
import QtQuick 2.15
|
||||
import QtQml.Models 2.15
|
||||
|
||||
Item {
|
||||
height: 200
|
||||
width: 100
|
||||
DelegateModel {
|
||||
id: dm
|
||||
model: 2
|
||||
delegate: Item {
|
||||
width: 100; height: 20
|
||||
property bool isCurrent: ListView.isCurrentItem
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
objectName: "listView"
|
||||
model: dm
|
||||
currentIndex: 1
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
|
@ -303,7 +303,6 @@ private slots:
|
|||
void requiredObjectListModel();
|
||||
void clickHeaderAndFooterWhenClip();
|
||||
void animatedDelegate();
|
||||
void isCurrentItem_DelegateModel();
|
||||
|
||||
// WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with.
|
||||
|
||||
|
@ -10125,20 +10124,6 @@ void tst_QQuickListView::animatedDelegate()
|
|||
}
|
||||
}
|
||||
|
||||
void tst_QQuickListView::isCurrentItem_DelegateModel()
|
||||
{
|
||||
QScopedPointer<QQuickView> window(createView());
|
||||
window->setSource(testFileUrl("qtbug86744.qml"));
|
||||
window->resize(640, 480);
|
||||
window->show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
|
||||
|
||||
QQuickListView* listView = window->rootObject()->findChild<QQuickListView*>("listView");
|
||||
QVERIFY(listView);
|
||||
QVariant value = listView->itemAtIndex(1)->property("isCurrent");
|
||||
QVERIFY(value.toBool() == true);
|
||||
}
|
||||
|
||||
// WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with.
|
||||
|
||||
QTEST_MAIN(tst_QQuickListView)
|
||||
|
|
Loading…
Reference in New Issue