Allow disabling internal deferred properties
Add environment variable to allow disabling internal deferred properties. We should not make generalized group properties that point to different objects immediate. However, for the intended use case it's enough to disable internal deferred properties. Task-number: QDS-8545 Pick-to: 6.5 Change-Id: I22d31587290020ec03274a3373a30be196185b84 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
a163fa3171
commit
7ad7eb606a
|
@ -18,6 +18,9 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
DEFINE_BOOL_CONFIG_OPTION(
|
||||
disableInternalDeferredProperties, QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES);
|
||||
|
||||
Q_LOGGING_CATEGORY(lcQmlTypeCompiler, "qt.qml.typecompiler");
|
||||
|
||||
QQmlTypeCompiler::QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlTypeData *typeData,
|
||||
|
@ -1110,10 +1113,13 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(
|
|||
COMPILE_EXCEPTION(binding, tr("You cannot assign an id to an object assigned "
|
||||
"to a deferred property."));
|
||||
}
|
||||
isDeferred = true;
|
||||
} else if (!deferredPropertyNames.isEmpty() && deferredPropertyNames.contains(name)) {
|
||||
if (!seenSubObjectWithId && binding->type() != Binding::Type_GroupProperty)
|
||||
if (isExternal || !disableInternalDeferredProperties())
|
||||
isDeferred = true;
|
||||
} else if (!deferredPropertyNames.isEmpty() && deferredPropertyNames.contains(name)) {
|
||||
if (!seenSubObjectWithId && binding->type() != Binding::Type_GroupProperty) {
|
||||
if (isExternal || !disableInternalDeferredProperties())
|
||||
isDeferred = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (binding->type() >= Binding::Type_Object) {
|
||||
|
|
|
@ -27,6 +27,22 @@ qt_internal_add_test(tst_qqmlbinding
|
|||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
qt_internal_add_test(tst_qqmlbinding_no_deferred_properties
|
||||
SOURCES
|
||||
tst_qqmlbinding.cpp
|
||||
WithBindableProperties.h
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::QmlPrivate
|
||||
Qt::QuickPrivate
|
||||
Qt::QuickTestUtilsPrivate
|
||||
TESTDATA ${test_data}
|
||||
DEFINES
|
||||
QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES
|
||||
)
|
||||
|
||||
set_target_properties(tst_qqmlbinding PROPERTIES
|
||||
QT_QML_MODULE_URI "test"
|
||||
QT_QML_MODULE_VERSION 1.0
|
||||
|
@ -34,9 +50,13 @@ set_target_properties(tst_qqmlbinding PROPERTIES
|
|||
|
||||
_qt_internal_qml_type_registration(tst_qqmlbinding)
|
||||
|
||||
set_target_properties(tst_qqmlbinding_no_deferred_properties PROPERTIES
|
||||
QT_QML_MODULE_URI "test"
|
||||
QT_QML_MODULE_VERSION 1.0
|
||||
)
|
||||
|
||||
_qt_internal_qml_type_registration(tst_qqmlbinding_no_deferred_properties)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_qqmlbinding CONDITION ANDROID OR IOS
|
||||
DEFINES
|
||||
|
@ -47,3 +67,13 @@ qt_internal_extend_target(tst_qqmlbinding CONDITION NOT ANDROID AND NOT IOS
|
|||
DEFINES
|
||||
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_qqmlbinding_no_deferred_properties CONDITION ANDROID OR IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR=":/data"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_qqmlbinding_no_deferred_properties CONDITION NOT ANDROID AND NOT IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
)
|
||||
|
|
|
@ -46,6 +46,9 @@ private:
|
|||
tst_qqmlbinding::tst_qqmlbinding()
|
||||
: QQmlDataTest(QT_QMLTEST_DATADIR)
|
||||
{
|
||||
#ifdef QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES
|
||||
qputenv("QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES", "1");
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_qqmlbinding::binding()
|
||||
|
|
|
@ -26,6 +26,21 @@ qt_internal_add_test(tst_qquickstates
|
|||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
qt_internal_add_test(tst_qquickstates_no_deferred_properties
|
||||
SOURCES
|
||||
tst_qquickstates.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::QmlPrivate
|
||||
Qt::QuickPrivate
|
||||
Qt::QuickTestUtilsPrivate
|
||||
TESTDATA ${test_data}
|
||||
DEFINES
|
||||
QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
|
@ -38,3 +53,13 @@ qt_internal_extend_target(tst_qquickstates CONDITION NOT ANDROID AND NOT IOS
|
|||
DEFINES
|
||||
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_qquickstates_no_deferred_properties CONDITION ANDROID OR IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR=":/data"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_qquickstates_no_deferred_properties CONDITION NOT ANDROID AND NOT IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
)
|
||||
|
|
|
@ -119,7 +119,12 @@ class tst_qquickstates : public QQmlDataTest
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
tst_qquickstates() : QQmlDataTest(QT_QMLTEST_DATADIR) {}
|
||||
tst_qquickstates() : QQmlDataTest(QT_QMLTEST_DATADIR)
|
||||
{
|
||||
#ifdef QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES
|
||||
qputenv("QML_DISABLE_INTERNAL_DEFERRED_PROPERTIES", "1");
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray fullDataPath(const QString &path) const;
|
||||
|
|
Loading…
Reference in New Issue