diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-24 16:19:48 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-24 16:26:35 +0200 |
commit | 09cc372a3a14906aa2130f44c4950dcdd8c9bf0d (patch) | |
tree | 20064c825a30c63d46c45203880eef364ca20a00 /src/qmlmodels | |
parent | 78254be6cbd239a3de332c5660b2c408d9f3e674 (diff) | |
parent | 487d22bcde7e9d06162d44e7c5dca31d3afac694 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I52b2d17d9334313e4b3d84b52432f2ebc77f7415
Diffstat (limited to 'src/qmlmodels')
-rw-r--r-- | src/qmlmodels/configure.cmake | 4 | ||||
-rw-r--r-- | src/qmlmodels/configure.json | 4 | ||||
-rw-r--r-- | src/qmlmodels/qqmladaptormodel.cpp | 10 | ||||
-rw-r--r-- | src/qmlmodels/qqmllistmodel.cpp | 1 | ||||
-rw-r--r-- | src/qmlmodels/qqmlmodelsmodule.cpp | 43 | ||||
-rw-r--r-- | src/qmlmodels/qqmlmodelsmodule_p.h | 5 |
6 files changed, 19 insertions, 48 deletions
diff --git a/src/qmlmodels/configure.cmake b/src/qmlmodels/configure.cmake index 086b08ca8a..b8409f7106 100644 --- a/src/qmlmodels/configure.cmake +++ b/src/qmlmodels/configure.cmake @@ -23,15 +23,17 @@ qt_feature("qml_list_model" PRIVATE SECTION "QML" LABEL "QML list model" PURPOSE "Provides the ListModel QML type." + CONDITION QT_FEATURE_qml_itemmodel ) qt_feature("qml_delegate_model" PRIVATE SECTION "QML" LABEL "QML delegate model" PURPOSE "Provides the DelegateModel QML type." - CONDITION QT_FEATURE_qml_object_model + CONDITION QT_FEATURE_qml_object_model AND QT_FEATURE_qml_itemmodel ) qt_feature("qml_table_model" PRIVATE SECTION "QML" LABEL "QML table model" PURPOSE "Provides the TableModel QML type." + CONDITION QT_FEATURE_qml_itemmodel ) diff --git a/src/qmlmodels/configure.json b/src/qmlmodels/configure.json index bfe7d538ec..2b4fa4f6e2 100644 --- a/src/qmlmodels/configure.json +++ b/src/qmlmodels/configure.json @@ -16,19 +16,21 @@ "label": "QML list model", "purpose": "Provides the ListModel QML type.", "section": "QML", + "condition": "features.qml-itemmodel", "output": [ "privateFeature" ] }, "qml-delegate-model": { "label": "QML delegate model", "purpose": "Provides the DelegateModel QML type.", "section": "QML", - "condition": "features.qml-object-model", + "condition": "features.qml-object-model && features.qml-itemmodel", "output": [ "privateFeature" ] }, "qml-table-model": { "label": "QML table model", "purpose": "Provides the TableModel QML type.", "section": "QML", + "condition": "features.qml-itemmodel", "output": [ "privateFeature" ] } }, diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp index 0bc67e1aad..48ff4e7d5b 100644 --- a/src/qmlmodels/qqmladaptormodel.cpp +++ b/src/qmlmodels/qqmladaptormodel.cpp @@ -161,8 +161,14 @@ public: signalIndexes.append(propertyId + signalOffset); } - for (int i = 0, c = items.count(); i < c; ++i) { - QQmlDelegateModelItem *item = items.at(i); + QVarLengthArray<QQmlGuard<QQmlDelegateModelItem>> guardedItems; + for (const auto item : items) + guardedItems.append(item); + + for (const auto &item : qAsConst(guardedItems)) { + if (item.isNull()) + continue; + const int idx = item->modelIndex(); if (idx >= index && idx < index + count) { for (int i = 0; i < signalIndexes.count(); ++i) diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index c1684d955c..1cd089f454 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -53,6 +53,7 @@ #include <private/qv4objectiterator_p.h> #include <private/qv4alloca_p.h> #include <private/qv4lookup_p.h> +#include <private/qv4qmlcontext_p.h> #include <qqmlcontext.h> #include <qqmlinfo.h> diff --git a/src/qmlmodels/qqmlmodelsmodule.cpp b/src/qmlmodels/qqmlmodelsmodule.cpp index 2db5dd834f..5195f9baad 100644 --- a/src/qmlmodels/qqmlmodelsmodule.cpp +++ b/src/qmlmodels/qqmlmodelsmodule.cpp @@ -62,58 +62,23 @@ QT_BEGIN_NAMESPACE -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - -void QQmlModelsModule::registerQmlTypes() -{ - // Don't add anything here. These are only for backwards compatibility. -#if QT_CONFIG(qml_object_model) - qmlRegisterType<QQmlInstantiator>("QtQml", 2, 1, "Instantiator"); // Only available in >= 2.1 - qmlRegisterType<QQmlInstanceModel>(); -#endif -} - -void QQmlModelsModule::registerQuickTypes() -{ - // Don't add anything here. These are only for backwards compatibility. - - const char uri[] = "QtQuick"; - -#if QT_CONFIG(qml_object_model) - qmlRegisterType<QQmlInstantiator>(uri, 2, 1, "Instantiator"); - qmlRegisterType<QQmlInstanceModel>(); - qmlRegisterType<QQmlObjectModel>(uri, 2, 0, "VisualItemModel"); -#endif -#if QT_CONFIG(qml_list_model) - qmlRegisterType<QQmlListElement>(uri, 2, 0, "ListElement"); - qmlRegisterCustomType<QQmlListModel>(uri, 2, 0, "ListModel", new QQmlListModelParser); -#endif -#if QT_CONFIG(qml_delegate_model) - qmlRegisterType<QQmlDelegateModel>(uri, 2, 0, "VisualDataModel"); - qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 0, "VisualDataGroup"); - qmlRegisterType<QQuickPackage>(uri, 2, 0, "Package"); -#endif -} - -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - void QQmlModelsModule::defineModule() { const char uri[] = "QtQml.Models"; #if QT_CONFIG(qml_list_model) - qmlRegisterType<QQmlListElement>(uri, 2, 1, "ListElement"); - qmlRegisterCustomType<QQmlListModel>(uri, 2, 1, "ListModel", new QQmlListModelParser); + qmlRegisterType<QQmlListElement>(uri, 2, 0, "ListElement"); + qmlRegisterCustomType<QQmlListModel>(uri, 2, 0, "ListModel", new QQmlListModelParser); #endif #if QT_CONFIG(qml_delegate_model) qmlRegisterType<QQmlDelegateModel>(uri, 2, 1, "DelegateModel"); qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 1, "DelegateModelGroup"); - qmlRegisterType<QQuickPackage>(uri, 2, 14, "Package"); + qmlRegisterType<QQuickPackage>(uri, 2, 0, "Package"); #endif #if QT_CONFIG(qml_object_model) qmlRegisterType<QQmlObjectModel>(uri, 2, 1, "ObjectModel"); qmlRegisterType<QQmlObjectModel,3>(uri, 2, 3, "ObjectModel"); - qmlRegisterType<QQmlInstantiator>(uri, 2, 14, "Instantiator"); + qmlRegisterType<QQmlInstantiator>(uri, 2, 1, "Instantiator"); qmlRegisterType<QQmlInstanceModel>(); #endif #if QT_CONFIG(itemmodel) diff --git a/src/qmlmodels/qqmlmodelsmodule_p.h b/src/qmlmodels/qqmlmodelsmodule_p.h index 7e02578db9..f63052b682 100644 --- a/src/qmlmodels/qqmlmodelsmodule_p.h +++ b/src/qmlmodels/qqmlmodelsmodule_p.h @@ -58,11 +58,6 @@ QT_BEGIN_NAMESPACE class Q_QMLMODELS_PRIVATE_EXPORT QQmlModelsModule { public: -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - static void registerQmlTypes(); - static void registerQuickTypes(); -#endif - static void defineModule(); static void defineLabsModule(); }; |