diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2022-02-09 12:10:34 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2022-02-21 18:20:57 +0100 |
commit | e2864d6aa97d246546514ec0f97263574d19ec47 (patch) | |
tree | 0ce32728dd95cb7a4049ad0ea4b774d19d29b38d | |
parent | 094663177dd90ca139233559de034419c21d4db0 (diff) |
qmlmodels: Move QModelIndex from QtQml
Moves the QModelIndex value types from QtQml to QtQml.Models as they
cannot otherwise be properly resolved in tooling.
Pick-to: 6.3 6.2
Fixes: QTBUG-100338
Change-Id: I30fc18b388974238ba8353e87ef09f57f8ceabd1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | src/qml/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 14 | ||||
-rw-r--r-- | src/qmlmodels/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/qmlmodels/qqmlmodelindexvaluetype.cpp (renamed from src/qml/types/qqmlmodelindexvaluetype.cpp) | 0 | ||||
-rw-r--r-- | src/qmlmodels/qqmlmodelindexvaluetype_p.h (renamed from src/qml/types/qqmlmodelindexvaluetype_p.h) | 0 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/data/qmodelIndex.qml | 6 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlitemmodels/data/modelindex.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml | 1 |
10 files changed, 15 insertions, 20 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 2fbf187978..6420411427 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -584,11 +584,6 @@ qt_internal_extend_target(Qml CONDITION hpux-_x_ OR solaris-_x_ OR (QT_FEATURE_c rt ) -qt_internal_extend_target(Qml CONDITION QT_FEATURE_qml_itemmodel - SOURCES - types/qqmlmodelindexvaluetype.cpp types/qqmlmodelindexvaluetype_p.h -) - qt_internal_extend_target(Qml CONDITION disassembler AND ((TEST_architecture_arch STREQUAL "i386") OR (TEST_architecture_arch STREQUAL "x86_64")) DEFINES WTF_USE_UDIS86=1 diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h index 38fde91233..ff09ec815c 100644 --- a/src/qml/jsruntime/qv4sequenceobject_p.h +++ b/src/qml/jsruntime/qv4sequenceobject_p.h @@ -61,8 +61,8 @@ #include "qv4string_p.h" #if QT_CONFIG(qml_itemmodel) -#include <private/qqmlmodelindexvaluetype_p.h> #include <QtCore/qabstractitemmodel.h> +#include <QtCore/qitemselectionmodel.h> #endif QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index fb0e2af578..0a70c6e676 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -47,10 +47,6 @@ #include <private/qqmlvaluetype_p.h> #include <private/qv4executablecompilationunit_p.h> -#if QT_CONFIG(qml_itemmodel) -#include <private/qqmlmodelindexvaluetype_p.h> -#endif - #include <QtCore/qcoreapplication.h> #include <QtCore/qmutex.h> #include <QtCore/qloggingcategory.h> @@ -1718,17 +1714,7 @@ const QMetaObject *QQmlMetaType::metaObjectForValueType(QMetaType metaType) case QMetaType::QEasingCurve: return &QQmlEasingValueType::staticMetaObject; #endif -#if QT_CONFIG(qml_itemmodel) - case QMetaType::QModelIndex: - return &QQmlModelIndexValueType::staticMetaObject; - case QMetaType::QPersistentModelIndex: - return &QQmlPersistentModelIndexValueType::staticMetaObject; -#endif default: -#if QT_CONFIG(qml_itemmodel) - if (metaType == QMetaType::fromType<QItemSelectionRange>()) - return &QQmlItemSelectionRangeValueType::staticMetaObject; -#endif break; } diff --git a/src/qmlmodels/CMakeLists.txt b/src/qmlmodels/CMakeLists.txt index ccee022672..1f8ffcdadf 100644 --- a/src/qmlmodels/CMakeLists.txt +++ b/src/qmlmodels/CMakeLists.txt @@ -29,6 +29,11 @@ qt_internal_add_qml_module(QmlModels GENERATE_PRIVATE_CPP_EXPORTS ) +qt_internal_extend_target(QmlModels CONDITION QT_FEATURE_qml_itemmodel + SOURCES + qqmlmodelindexvaluetype.cpp qqmlmodelindexvaluetype_p.h +) + qt_internal_extend_target(QmlModels CONDITION QT_FEATURE_qml_object_model SOURCES qqmlinstantiator.cpp qqmlinstantiator_p.h diff --git a/src/qml/types/qqmlmodelindexvaluetype.cpp b/src/qmlmodels/qqmlmodelindexvaluetype.cpp index cbf2fef348..cbf2fef348 100644 --- a/src/qml/types/qqmlmodelindexvaluetype.cpp +++ b/src/qmlmodels/qqmlmodelindexvaluetype.cpp diff --git a/src/qml/types/qqmlmodelindexvaluetype_p.h b/src/qmlmodels/qqmlmodelindexvaluetype_p.h index 2c37d91c71..2c37d91c71 100644 --- a/src/qml/types/qqmlmodelindexvaluetype_p.h +++ b/src/qmlmodels/qqmlmodelindexvaluetype_p.h diff --git a/tests/auto/qml/qmllint/data/qmodelIndex.qml b/tests/auto/qml/qmllint/data/qmodelIndex.qml new file mode 100644 index 0000000000..e0df84b68b --- /dev/null +++ b/tests/auto/qml/qmllint/data/qmodelIndex.qml @@ -0,0 +1,6 @@ +import QtQml + +QtObject { + property ItemSelectionModel itemSelectionModel; + function row() { return itemSelectionModel.currentIndex.row; } +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index badcab11c5..880f8771df 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -1026,6 +1026,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("unexportedCppBase") << QStringLiteral("unexportedCppBase.qml"); QTest::newRow("requiredWithRootLevelAlias") << QStringLiteral("RequiredWithRootLevelAlias.qml"); QTest::newRow("jsVarDeclarations") << QStringLiteral("jsVarDeclarations.qml"); + QTest::newRow("qmodelIndex") << QStringLiteral("qmodelIndex.qml"); } void TestQmllint::cleanQmlCode() diff --git a/tests/auto/qml/qqmlitemmodels/data/modelindex.qml b/tests/auto/qml/qqmlitemmodels/data/modelindex.qml index 0d6e3624cb..2756f04120 100644 --- a/tests/auto/qml/qqmlitemmodels/data/modelindex.qml +++ b/tests/auto/qml/qqmlitemmodels/data/modelindex.qml @@ -1,3 +1,4 @@ +import QtQml 2.0 import Test 1.0 ItemModelsTest { diff --git a/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml b/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml index 13037065a6..85987bdcac 100644 --- a/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml +++ b/tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml @@ -1,3 +1,4 @@ +import QtQml 2.0 import Test 1.0 ItemModelsTest { |