diff --git a/plugins/qmlsupport/qmlcontextpropertyadaptor.cpp b/plugins/qmlsupport/qmlcontextpropertyadaptor.cpp index 663e46871..69459feb9 100644 --- a/plugins/qmlsupport/qmlcontextpropertyadaptor.cpp +++ b/plugins/qmlsupport/qmlcontextpropertyadaptor.cpp @@ -17,13 +17,14 @@ #include #include -#include #include #include using namespace GammaRay; +#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0) + QmlContextPropertyAdaptor::QmlContextPropertyAdaptor(QObject *parent) : PropertyAdaptor(parent) { @@ -107,3 +108,5 @@ QmlContextPropertyAdaptorFactory *QmlContextPropertyAdaptorFactory::instance() s_instance = new QmlContextPropertyAdaptorFactory; return s_instance; } + +#endif diff --git a/plugins/qmlsupport/qmlcontextpropertyadaptor.h b/plugins/qmlsupport/qmlcontextpropertyadaptor.h index 8e0ed0f59..1c5a28ba1 100644 --- a/plugins/qmlsupport/qmlcontextpropertyadaptor.h +++ b/plugins/qmlsupport/qmlcontextpropertyadaptor.h @@ -19,6 +19,8 @@ #include +#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0) + namespace GammaRay { class QmlContextPropertyAdaptor : public PropertyAdaptor { @@ -50,3 +52,5 @@ class QmlContextPropertyAdaptorFactory : public AbstractPropertyAdaptorFactory } #endif + +#endif diff --git a/plugins/qmlsupport/qmlsupport.cpp b/plugins/qmlsupport/qmlsupport.cpp index 795decd9b..5c0b307ff 100644 --- a/plugins/qmlsupport/qmlsupport.cpp +++ b/plugins/qmlsupport/qmlsupport.cpp @@ -318,7 +318,9 @@ QmlSupport::QmlSupport(Probe *probe, QObject *parent) PropertyAdaptorFactory::registerFactory(QmlListPropertyAdaptorFactory::instance()); PropertyAdaptorFactory::registerFactory(QmlAttachedPropertyAdaptorFactory::instance()); PropertyAdaptorFactory::registerFactory(QJSValuePropertyAdaptorFactory::instance()); +#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0) PropertyAdaptorFactory::registerFactory(QmlContextPropertyAdaptorFactory::instance()); +#endif PropertyController::registerExtension(); PropertyController::registerExtension(); diff --git a/tests/qmlsupporttest.cpp b/tests/qmlsupporttest.cpp index 0bc9c4010..b98eb5085 100644 --- a/tests/qmlsupporttest.cpp +++ b/tests/qmlsupporttest.cpp @@ -56,7 +56,9 @@ private slots: PropertyAdaptorFactory::registerFactory(QmlListPropertyAdaptorFactory::instance()); PropertyAdaptorFactory::registerFactory(QmlAttachedPropertyAdaptorFactory::instance()); PropertyAdaptorFactory::registerFactory(QJSValuePropertyAdaptorFactory::instance()); +#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0) PropertyAdaptorFactory::registerFactory(QmlContextPropertyAdaptorFactory::instance()); +#endif } void testQmlListProperty() @@ -157,25 +159,6 @@ Rectangle { delete obj; } - - void testContextProperty() - { - QQmlEngine engine; - engine.rootContext()->setContextProperty("myContextProp", 42); - - auto adaptor = PropertyAdaptorFactory::create(engine.rootContext(), this); - QVERIFY(adaptor); - - auto idx = indexOfProperty(adaptor, "myContextProp"); - QVERIFY(idx >= 0); - - auto data = adaptor->propertyData(idx); - QCOMPARE(data.name(), QStringLiteral("myContextProp")); - QCOMPARE(data.value().toInt(), 42); - - adaptor->writeProperty(idx, 23); - QCOMPARE(engine.rootContext()->contextProperty("myContextProp").toInt(), 23); - } }; QTEST_MAIN(QmlSupportTest)