aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2022-02-09 12:10:34 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2022-02-22 12:56:39 +0100
commit1cd6375113963fc180d88bd201db397b45e76c9d (patch)
tree50998dcc088e894cb85a1d4081dc48ae901b3bb9
parenteaf00da10a4ae10b6b26684fe5893f671ad8f631 (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. 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> (cherry picked from commit e2864d6aa97d246546514ec0f97263574d19ec47) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/qml/CMakeLists.txt5
-rw-r--r--src/qml/jsruntime/qv4sequenceobject_p.h2
-rw-r--r--src/qml/qml/qqmlmetatype.cpp14
-rw-r--r--src/qmlmodels/CMakeLists.txt5
-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.qml6
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp1
-rw-r--r--tests/auto/qml/qqmlitemmodels/data/modelindex.qml1
-rw-r--r--tests/auto/qml/qqmlitemmodels/data/persistentmodelindex.qml1
10 files changed, 15 insertions, 20 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt
index 4d460286ff..71e1050eb0 100644
--- a/src/qml/CMakeLists.txt
+++ b/src/qml/CMakeLists.txt
@@ -587,11 +587,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 d7bc7327c5..d65d55d6e8 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_REQUIRE_CONFIG(qml_sequence_object);
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 8c62ca6c7a..85fa57d8eb 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>
@@ -1597,17 +1593,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 7057d31a66..20819b30e6 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -972,6 +972,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("cppPropertyChangeHandlers")
<< QStringLiteral("goodCppPropertyChangeHandlers.qml");
QTest::newRow("unexportedCppBase") << QStringLiteral("unexportedCppBase.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 {