diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-08-29 15:03:49 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-09-06 10:58:39 +0000 |
commit | edb79c31ab18a051d496d517ec65aed460f3c1f5 (patch) | |
tree | dd8a5b35e35cfd76c2e215678b9638e26c72002e /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | fa74444ed06e4db21b0e9829a5832b886b39d372 (diff) |
QQmlDelegateModel: don't fall back to use DelegateChooser as delegate
If the application uses a DelegateChooser, but the chooser fails to
resolve a delegate for a certain index, it should not use itself
as the delegate instead. This will cause the application to crash.
Instead, return nullptr (like we do in the function guard), which
will let the item views handle the situation gracefully.
Change-Id: I9b3b4aa2626d1f8521b4395096300ac12150c63f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 9c11957894..1ca341fe66 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -267,6 +267,8 @@ private slots: void QTBUG_34576_velocityZero(); void QTBUG_61537_modelChangesAsync(); + void useDelegateChooserWithoutDefault(); + void addOnCompleted(); private: @@ -8858,6 +8860,15 @@ void tst_QQuickListView::addOnCompleted() } } +void tst_QQuickListView::useDelegateChooserWithoutDefault() +{ + // Check that the application doesn't crash + // if the delegate chooser doesn't cover all cells + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("usechooserwithoutdefault.qml")); + window->show(); +}; + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |