diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-09 10:28:48 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-09 10:28:48 +0200 |
commit | 5517c63c2eb601f3a9a2cb1e43d21b5e662b18cc (patch) | |
tree | 9b8e50a5312dc17d388f3425ffb9ea9fb0db6bef /tests/auto/quick/qquicklistview | |
parent | c3cbbf362c769b065fd0586b0510d043cbae92a4 (diff) | |
parent | 45f79dc7e572c1a1e4c40633d5055d0c6741cfbe (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
src/qml/qml/qqmlcomponent.cpp
tests/auto/quick/scenegraph/tst_scenegraph.cpp
Change-Id: Ibc811b95a57f175ca53337db7bbd1f575a745937
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index bf9df7850d..b0d903908f 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -250,6 +250,7 @@ private slots: void QTBUG_50105(); void keyNavigationEnabled(); void QTBUG_50097_stickyHeader_positionViewAtIndex(); + void itemFiltered(); private: template <class T> void items(const QUrl &source); @@ -8343,6 +8344,37 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex() QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header. } +void tst_QQuickListView::itemFiltered() +{ + QStringListModel model(QStringList() << "one" << "two" << "three" << "four" << "five" << "six"); + QSortFilterProxyModel proxy1; + proxy1.setSourceModel(&model); + proxy1.setSortRole(Qt::DisplayRole); + proxy1.setDynamicSortFilter(true); + proxy1.sort(0); + + QSortFilterProxyModel proxy2; + proxy2.setSourceModel(&proxy1); + proxy2.setFilterRole(Qt::DisplayRole); + proxy2.setFilterRegExp("^[^ ]*$"); + proxy2.setDynamicSortFilter(true); + + QScopedPointer<QQuickView> window(createView()); + window->engine()->rootContext()->setContextProperty("_model", &proxy2); + QQmlComponent component(window->engine()); + component.setData("import QtQuick 2.4; ListView { " + "anchors.fill: parent; model: _model; delegate: Text { width: parent.width;" + "text: model.display; } }", + QUrl()); + window->setContent(QUrl(), &component, component.create()); + + window->show(); + QTest::qWaitForWindowExposed(window.data()); + + // this should not crash + model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |