diff options
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 66 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 18 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 8 |
3 files changed, 64 insertions, 28 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 6122394e09..c9aebff06d 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -2946,6 +2946,7 @@ function(qt6_target_qml_sources target) set(actual_${file_set} "") set(actual_${file_set}_absolute "") set(duplicate_in_${file_set} "") + set(duplicate_input_in_${file_set} "") get_target_property(current_${file_set} ${target} QT_QML_MODULE_${file_set}) foreach(file_src IN LISTS arg_${file_set}) # TODO: For now we check against absolute path to avoid surprises with other @@ -2953,7 +2954,7 @@ function(qt6_target_qml_sources target) get_filename_component(file_absolute ${file_src} ABSOLUTE) # Check for duplicates in the current list if(file_absolute IN_LIST actual_${file_set}_absolute) - # We can silently ignore these because they have the same function parameters + list(APPEND duplicate_input_in_${file_set}) continue() endif() # Check for duplicates in the target property added so far @@ -2984,8 +2985,26 @@ function(qt6_target_qml_sources target) endforeach() # Display warnings for all invalid files - # Warn about duplicated files - if(duplicate_in_${file_set}) + # Warn about duplicated files in input + if(NOT QT_QML_IGNORE_DUPLICATE_FILES AND duplicate_input_in_${file_set}) + # We trigger a warning here because it was added before with potentially different + # parameters, properties + set(warning_message + "The following files are passed more than once ${file_set}:" + ) + list(JOIN duplicate_input_in_${file_set} + "\n${warning_message_file_prefix}" + warning_file_set + ) + string(APPEND warning_message + "\n${warning_message_file_prefix}" + "${warning_file_set}\n" + "(this message can be suppressed by setting QT_QML_IGNORE_DUPLICATE_FILES=ON)" + ) + message(WARNING "${warning_message}") + endif() + # Warn about duplicated files overall + if(NOT QT_QML_IGNORE_DUPLICATE_FILES AND duplicate_in_${file_set}) # We trigger a warning here because it was added before with potentially different # parameters, properties set(warning_message @@ -2997,7 +3016,8 @@ function(qt6_target_qml_sources target) ) string(APPEND warning_message "\n${warning_message_file_prefix}" - "${warning_file_set}" + "${warning_file_set}\n" + "(this message can be suppressed by setting QT_QML_IGNORE_DUPLICATE_FILES=ON)" ) message(WARNING "${warning_message}") endif() @@ -3617,24 +3637,26 @@ function(qt6_target_qml_sources target) endif() set(qml_resource_name ${target}_raw_qml_${counter}) - set(qml_resource_targets) - set(qml_resource_options) - if(discard_qml_contents) - list(APPEND qml_resource_options DISCARD_FILE_CONTENTS) - endif() - qt6_add_resources(${target} ${qml_resource_name} - PREFIX ${arg_PREFIX} - FILES ${actual_QML_FILES} - OUTPUT_TARGETS qml_resource_targets - ${qml_resource_options} - ) - list(APPEND output_targets ${qml_resource_targets}) - # Save the resource name in a property so we can reference it later in a qml plugin - # constructor, to avoid discarding the resource if it's in a static library. - __qt_internal_sanitize_resource_name( - sanitized_qml_resource_name "${qml_resource_name}") - set_property(TARGET ${target} APPEND PROPERTY - _qt_qml_module_sanitized_resource_names "${sanitized_qml_resource_name}") + if(actual_QML_FILES) + set(qml_resource_targets "") + set(qml_resource_options "") + if(discard_qml_contents) + list(APPEND qml_resource_options DISCARD_FILE_CONTENTS) + endif() + qt6_add_resources(${target} ${qml_resource_name} + PREFIX ${arg_PREFIX} + FILES ${actual_QML_FILES} + OUTPUT_TARGETS qml_resource_targets + ${qml_resource_options} + ) + list(APPEND output_targets ${qml_resource_targets}) + # Save the resource name in a property so we can reference it later in a qml plugin + # constructor, to avoid discarding the resource if it's in a static library. + __qt_internal_sanitize_resource_name( + sanitized_qml_resource_name "${qml_resource_name}") + set_property(TARGET ${target} APPEND PROPERTY + _qt_qml_module_sanitized_resource_names "${sanitized_qml_resource_name}") + endif() if(actual_RESOURCES) set(resources_resource_name ${target}_raw_res_${counter}) diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index c4e0ea1b2b..803521fa63 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1140,13 +1140,19 @@ QObject *QQmlComponentPrivate::beginCreate(QQmlRefPointer<QQmlContextData> conte m_state.ensureRequiredPropertyStorage(rv); } - for (int i = 0, propertyCount = propertyCache->propertyCount(); i < propertyCount; ++i) { - if (const QQmlPropertyData *propertyData = propertyCache->property(i); propertyData->isRequired()) { - m_state.ensureRequiredPropertyStorage(rv); - RequiredPropertyInfo info; - info.propertyName = propertyData->name(rv); - m_state.addPendingRequiredProperty(rv, propertyData, info); + if (propertyCache) { + for (int i = 0, propertyCount = propertyCache->propertyCount(); i < propertyCount; ++i) { + if (const QQmlPropertyData *propertyData = propertyCache->property(i); propertyData->isRequired()) { + m_state.ensureRequiredPropertyStorage(rv); + RequiredPropertyInfo info; + info.propertyName = propertyData->name(rv); + m_state.addPendingRequiredProperty(rv, propertyData, info); + } } + } else { + // we couldn't get a propertyCache from ensurePropertyCache + // it is unclear what we can do in that case + // ### TOOD: QTBUG-136560 } } diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index e267392a59..3bf22d77a4 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -311,6 +311,11 @@ void QQmlMetaType::clearTypeRegistrations() data->undeletableTypes.clear(); data->propertyCaches.clear(); + qDeleteAll(data->metaTypeToValueType); + data->metaTypeToValueType.clear(); + + data->moduleImports.clear(); + // Avoid deletion recursion (via QQmlTypePrivate dtor) by moving them out of the way first. QQmlMetaTypeData::CompositeTypes emptyComposites; emptyComposites.swap(data->compositeTypes); @@ -1862,6 +1867,9 @@ static bool isInternalType(int idx) bool QQmlMetaType::isValueType(QMetaType type) { + if (type.flags().testFlag(QMetaType::PointerToQObject)) + return false; + if (!type.isValid() || isInternalType(type.id())) return false; |