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>
This commit is contained in:
Maximilian Goldstein 2022-02-09 12:10:34 +01:00
parent 094663177d
commit e2864d6aa9
10 changed files with 15 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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>
@ -1717,18 +1713,8 @@ const QMetaObject *QQmlMetaType::metaObjectForValueType(QMetaType metaType)
#if QT_CONFIG(easingcurve)
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;
}

View File

@ -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

View File

@ -0,0 +1,6 @@
import QtQml
QtObject {
property ItemSelectionModel itemSelectionModel;
function row() { return itemSelectionModel.currentIndex.row; }
}

View File

@ -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()

View File

@ -1,3 +1,4 @@
import QtQml 2.0
import Test 1.0
ItemModelsTest {

View File

@ -1,3 +1,4 @@
import QtQml 2.0
import Test 1.0
ItemModelsTest {