diff options
-rw-r--r-- | src/qmlmodels/qqmldmlistaccessordata_p.h | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/qmlmodels/qqmldmlistaccessordata_p.h b/src/qmlmodels/qqmldmlistaccessordata_p.h index e0fe24c1e1..e02c3a88f6 100644 --- a/src/qmlmodels/qqmldmlistaccessordata_p.h +++ b/src/qmlmodels/qqmldmlistaccessordata_p.h @@ -196,7 +196,7 @@ public: template<typename String> void createPropertyIfMissing(const String &string) { - for (int i = propertyOffset, end = propertyCount(); i < end; ++i) { + for (int i = 0, end = propertyCount(); i < end; ++i) { if (QAnyStringView(property(i).name()) == QAnyStringView(string)) return; } diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp index e3fa762b25..01aa9a5937 100644 --- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp +++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp @@ -493,13 +493,14 @@ void tst_QQmlDelegateModel::overriddenModelData() QObject *delegate = delegateModel->object(0); QVERIFY(delegate); - if (i == 2) { + if (i == 1 || i == 2) { + // You can actually not override if the model is a QObject or a JavaScript array. // Someone is certainly relying on this. // We need to find a migration mechanism to fix it. - QEXPECT_FAIL("", "You can actually not override if the model is a QObject", Continue); + QCOMPARE(delegate->objectName(), QLatin1String(" 0 0 e 0")); + } else { + QCOMPARE(delegate->objectName(), QLatin1String("a b c d e f")); } - - QCOMPARE(delegate->objectName(), QLatin1String("a b c d e f")); } } |