diff options
| -rw-r--r-- | src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp | 3 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 34 | ||||
| -rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 6 | ||||
| -rw-r--r-- | src/qml/qml/qqmlmetatypedata_p.h | 2 | ||||
| -rw-r--r-- | src/qml/qml/qqmlscriptblob.cpp | 5 | ||||
| -rw-r--r-- | src/qml/qml/qqmltypedata.cpp | 42 | ||||
| -rw-r--r-- | src/qml/qml/qqmltypedata_p.h | 13 | ||||
| -rw-r--r-- | src/quick/items/qquickgridview.cpp | 4 | ||||
| -rw-r--r-- | src/quick/items/qquicktableview.cpp | 2 | ||||
| -rw-r--r-- | src/quickdialogs/quickdialogs/qquickabstractdialog.cpp | 3 | ||||
| -rw-r--r-- | src/quicktemplates/qquicktreeviewdelegate.cpp | 4 | ||||
| -rw-r--r-- | src/quickvectorimage/qquickvectorimage.cpp | 7 | ||||
| -rw-r--r-- | tests/auto/qml/qqmllanguage/data/+FOO/Selected.qml | 5 | ||||
| -rw-r--r-- | tests/auto/qml/qqmllanguage/data/FileSelectorBase.qml | 6 | ||||
| -rw-r--r-- | tests/auto/qml/qqmllanguage/data/Selected.qml | 5 | ||||
| -rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 22 | ||||
| -rw-r--r-- | tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 11 | ||||
| -rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 8 |
18 files changed, 87 insertions, 95 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp index ae5808e2be..b311e397f2 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp @@ -152,7 +152,8 @@ void QQmlPreviewHandler::loadUrl(const QUrl &url) void QQmlPreviewHandler::dropCU(const QUrl &url) { // Drop any existing compilation units for this URL from the type registry. - if (const auto cu = QQmlMetaType::obtainCompilationUnit(url)) + // There can be multiple, one for each engine. + while (const auto cu = QQmlMetaType::obtainCompilationUnit(url)) QQmlMetaType::unregisterInternalCompositeType(cu); } diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 59d2d6c7fa..5df48560e3 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -14,6 +14,7 @@ #include <private/qqmljsdiagnosticmessage_p.h> #include <private/qqmllist_p.h> #include <private/qqmllistwrapper_p.h> +#include <private/qqmlscriptblob_p.h> #include <private/qqmlscriptdata_p.h> #include <private/qqmltypeloader_p.h> #include <private/qqmltypewrapper_p.h> @@ -2165,37 +2166,8 @@ ExecutionEngine::Module ExecutionEngine::moduleForUrl( return *existingModule; } - // Compilation Unit present in QQmlMetaTypeData - if (auto cu = QQmlMetaType::obtainCompilationUnit(resolved)) - return executableCompilationUnit(std::move(cu)); - - // Compilation Unit readily loadable from .qmlc file or binary - QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError; - const DiskCacheOptions options = diskCacheOptions(); - if (const QQmlPrivate::CachedQmlUnit *cachedUnit = (options & DiskCache::Aot) - ? QQmlMetaType::findCachedCompilationUnit( - resolved, - (options & DiskCache::AotByteCode) - ? QQmlMetaType::AcceptUntyped - : QQmlMetaType::RequireFullyTyped, - &cacheError) - : nullptr) { - const auto cu = executableCompilationUnit( - QQml::makeRefPointer<QV4::CompiledData::CompilationUnit>( - cachedUnit->qmlData, cachedUnit->aotCompiledFunctions, - resolved.fileName(), resolved.toString())); - const auto data = cu->unitData(); - for (uint i = 0, end = data->moduleRequestTableSize; i < end; ++i) { - const auto dependency = moduleForUrl(cu->urlAt(data->moduleRequestTable()[i]), cu.data()); - QQmlRefPointer<QQmlScriptData> scriptData( - new QQmlScriptData, QQmlRefPointer<QQmlScriptData>::Adopt); - scriptData->url = dependency->finalUrl(); - scriptData->urlString = dependency->finalUrlString(); - scriptData->m_precompiledScript = dependency->baseCompilationUnit(); - cu->baseCompilationUnit()->dependentScripts.append(std::move(scriptData)); - } - return cu; - } + if (const auto blob = m_typeLoader->getScript(resolved, QQmlTypeLoader::Synchronous)) + return executableCompilationUnit(blob->scriptData()->compilationUnit()); // Unavailable return Module(); diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 248533a155..5e2e5eb488 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -386,8 +386,6 @@ QQmlType QQmlMetaType::registerInterface(const QQmlPrivate::RegisterInterface &t data->idToType.insert(priv->typeId.id(), priv); data->idToType.insert(priv->listId.id(), priv); - data->interfaces.insert(type.typeId.id()); - return QQmlType(priv); } @@ -1231,10 +1229,10 @@ QMetaMethod QQmlMetaType::defaultMethod(QObject *obj) /*! See qmlRegisterInterface() for information about when this will return true. */ -bool QQmlMetaType::isInterface(QMetaType type) +bool QQmlMetaType::isInterface(QMetaType metaType) { const QQmlMetaTypeDataPtr data; - return data->interfaces.contains(type.id()); + return QQmlType(data->idToType.value(metaType.id())).isInterface(); } const char *QQmlMetaType::interfaceIId(QMetaType metaType) diff --git a/src/qml/qml/qqmlmetatypedata_p.h b/src/qml/qml/qqmlmetatypedata_p.h index 416f9d61fb..6b6bae64f2 100644 --- a/src/qml/qml/qqmlmetatypedata_p.h +++ b/src/qml/qml/qqmlmetatypedata_p.h @@ -95,8 +95,6 @@ struct QQmlMetaTypeData QHash<QString, void (*)()> moduleTypeRegistrationFunctions; bool registerModuleTypes(const QString &uri); - QSet<int> interfaces; - QList<QQmlPrivate::AutoParentFunction> parentFunctions; QVector<QQmlPrivate::QmlUnitCacheLookupFunction> lookupCachedQmlUnit; diff --git a/src/qml/qml/qqmlscriptblob.cpp b/src/qml/qml/qqmlscriptblob.cpp index c08bcb62e0..a34d7acc2b 100644 --- a/src/qml/qml/qqmlscriptblob.cpp +++ b/src/qml/qml/qqmlscriptblob.cpp @@ -30,11 +30,6 @@ void QQmlScriptBlob::dataReceived(const SourceCodeData &data) assertTypeLoaderThread(); if (data.isCacheable()) { - if (auto unit = QQmlMetaType::obtainCompilationUnit(url())) { - initializeFromCompilationUnit(std::move(unit)); - return; - } - if (m_typeLoader->readCacheFile()) { auto unit = QQml::makeRefPointer<QV4::CompiledData::CompilationUnit>(); QString error; diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp index 0faed498fe..44e1635afc 100644 --- a/src/qml/qml/qqmltypedata.cpp +++ b/src/qml/qml/qqmltypedata.cpp @@ -65,9 +65,6 @@ bool QQmlTypeData::tryLoadFromDiskCache() if (!m_backupSourceCode.isCacheable()) return false; - if (auto unit = QQmlMetaType::obtainCompilationUnit(url())) - return loadFromDiskCache(unit); - if (!m_typeLoader->readCacheFile()) return false; @@ -746,11 +743,6 @@ void QQmlTypeData::initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *un { assertTypeLoaderThread(); - if (auto cu = QQmlMetaType::obtainCompilationUnit(finalUrl())) { - if (loadFromDiskCache(cu)) - return; - } - if (unit->qmlData->qmlUnit()->nObjects == 0) { setError(QQmlTypeLoader::tr("Cached QML Unit has no objects")); return; @@ -1042,20 +1034,22 @@ bool QQmlTypeData::resolveTypes() QQmlType::AnyRegistrationType, selfReferenceDetection) && reportErrors) return false; - if (ref.type.isComposite() && !ref.selfReference) { + if (ref.selfReference) { + // nothing to do + } else if (ref.type.isComposite()) { ref.typeData = typeLoader()->getType(ref.type.sourceUrl()); addDependency(ref.typeData.data()); - } - if (ref.type.isInlineComponentType()) { + } else if (ref.type.isInlineComponentType()) { QUrl containingTypeUrl = ref.type.sourceUrl(); - if (!containingTypeUrl.isEmpty() - && !QQmlMetaType::equalBaseUrls(finalUrl(), containingTypeUrl)) { + Q_ASSERT(!containingTypeUrl.isEmpty()); + if (QQmlMetaType::equalBaseUrls(finalUrl(), containingTypeUrl)) { + ref.selfReference = true; + } else { containingTypeUrl.setFragment(QString()); auto typeData = typeLoader()->getType(containingTypeUrl); - if (typeData.data() != this) { - ref.typeData = typeData; - addDependency(typeData.data()); - } + Q_ASSERT(typeData.data() != this); + ref.typeData = typeData; + addDependency(typeData.data()); } } @@ -1110,18 +1104,12 @@ QQmlError QQmlTypeData::buildTypeResolutionCaches( if (!resolvedType->selfReference && resolvedType->needsCreation) ref->setCompilationUnit(compilationUnit); } else if (qmlType.isInlineComponentType()) { - // Inline component + // Inline component. + // If it's from a different file we have a typeData and can't get here. // If it's defined in the same file we're currently compiling, we don't want to use it. // We're going to fill in the property caches later after all. - if (QQmlMetaType::equalBaseUrls(finalUrl(), qmlType.sourceUrl())) { - ref->setIsSelfReference(true); - } else { - // this is required for inline components in singletons - const QMetaType type = qmlType.typeId(); - ref->setTypePropertyCache(QQmlMetaType::propertyCacheForType(type)); - if (resolvedType->needsCreation) - ref->setCompilationUnit(QQmlMetaType::obtainCompilationUnit(type)); - } + Q_ASSERT(resolvedType->selfReference); + Q_ASSERT(ref->isSelfReference()); } else if (qmlType.isValid() && !resolvedType->selfReference) { Q_ASSERT(ref->type().isValid()); diff --git a/src/qml/qml/qqmltypedata_p.h b/src/qml/qml/qqmltypedata_p.h index f480d26742..d8b471a940 100644 --- a/src/qml/qml/qqmltypedata_p.h +++ b/src/qml/qml/qqmltypedata_p.h @@ -31,23 +31,22 @@ public: struct TypeReference { - TypeReference() : version(QTypeRevision::zero()), needsCreation(true) {} - - QV4::CompiledData::Location location; + QString prefix; // used by CompositeSingleton types QQmlType type; - QTypeRevision version; QQmlRefPointer<QQmlTypeData> typeData; + QV4::CompiledData::Location location; + QTypeRevision version = QTypeRevision::zero(); bool selfReference = false; - QString prefix; // used by CompositeSingleton types + bool needsCreation = true; + QString qualifiedName() const; - bool needsCreation; }; struct ScriptReference { - QV4::CompiledData::Location location; QString qualifier; QQmlRefPointer<QQmlScriptBlob> script; + QV4::CompiledData::Location location; }; private: diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 23e8c7ed47..2eb847131e 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -2709,7 +2709,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co \qmlmethod int QtQuick::GridView::indexAt(real x, real y) Returns the index of the visible item containing the point \a x, \a y in - \l {QQuickFlickable::contentItem}{content item} coordinates. If there is + \l {QtQuick::Flickable::contentItem}{content item} coordinates. If there is no item at the point specified, or the item is not visible -1 is returned. If the item is outside the visible area, -1 is returned, regardless of @@ -2743,7 +2743,7 @@ bool QQuickGridViewPrivate::needsRefillForAddedOrRemovedIndex(int modelIndex) co \qmlmethod Item QtQuick::GridView::itemAt(real x, real y) Returns the visible item containing the point \a x, \a y in - \l {QQuickFlickable::contentItem}{content item} coordinates. If there + \l {QtQuick::Flickable::contentItem}{content item} coordinates. If there is no item at the point specified, or the item is not visible null is returned. If the item is outside the visible area, null is returned, regardless of diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 0fe07b2cc9..8c82e07ec4 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -3584,7 +3584,7 @@ void QQuickTableViewPrivate::processRebuildTable() if (rebuildState == RebuildState::Begin) { qCDebug(lcTableViewDelegateLifecycle()) << "begin rebuild:" << q << "options:" << rebuildOptions; tableSizeBeforeRebuild = tableSize; - edgesBeforeRebuild = loadedItems.isEmpty() ? QMargins() + edgesBeforeRebuild = loadedItems.isEmpty() ? QMargins(-1,-1,-1,-1) : QMargins(q->leftColumn(), q->topRow(), q->rightColumn(), q->bottomRow()); } diff --git a/src/quickdialogs/quickdialogs/qquickabstractdialog.cpp b/src/quickdialogs/quickdialogs/qquickabstractdialog.cpp index a42a7d36f0..d7292ffebc 100644 --- a/src/quickdialogs/quickdialogs/qquickabstractdialog.cpp +++ b/src/quickdialogs/quickdialogs/qquickabstractdialog.cpp @@ -298,7 +298,8 @@ void QQuickAbstractDialog::setResult(int result) \qmlproperty enumeration QtQuick.Dialogs::Dialog::popupType \since 6.10 - This property can be used to change the \l {QQuickPopup::}{popupType} of the non-native quick dialog. + This property can be used to change the \l {QtQuick.Controls::Popup::}{popupType} + of the non-native quick dialog. The available values are: \value Popup.Item The dialog will appear as an item in the window of the nearest parent item. diff --git a/src/quicktemplates/qquicktreeviewdelegate.cpp b/src/quicktemplates/qquicktreeviewdelegate.cpp index 22ffc777fe..5294b7754f 100644 --- a/src/quicktemplates/qquicktreeviewdelegate.cpp +++ b/src/quicktemplates/qquicktreeviewdelegate.cpp @@ -205,7 +205,7 @@ QT_BEGIN_NAMESPACE If no indicator is visible, the space will be between the left edge of the view and the left edge of the contentItem. - \sa rightMargin, indentation, {QQuickControl::}{spacing} + \sa rightMargin, indentation, {QtQuick.Controls::Control::}{spacing} */ /*! @@ -214,7 +214,7 @@ QT_BEGIN_NAMESPACE This property holds the space between the right edge of the view and the right edge of the contentItem. - \sa leftMargin, indentation, {QQuickControl::}{spacing} + \sa leftMargin, indentation, {QtQuick.Controls::Control::}{spacing} */ using namespace Qt::Literals::StringLiterals; diff --git a/src/quickvectorimage/qquickvectorimage.cpp b/src/quickvectorimage/qquickvectorimage.cpp index 707082101a..a55cc0d705 100644 --- a/src/quickvectorimage/qquickvectorimage.cpp +++ b/src/quickvectorimage/qquickvectorimage.cpp @@ -37,9 +37,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, vectorImagePluginLoader, Qt Quick Vector Image provides support for displaying vector image files in a Qt Quick scene. - It currently supports the \c SVG file format. In addition, Lottie support can be enabled by - setting the \l{assumeTrustedSource} property to true and including the plugin from the - \l{Qt Lottie Animation} module. + It currently supports the \c SVG file format. In addition, Lottie support + can be enabled by setting the + \l{QtQuick.VectorImage::VectorImage::}{assumeTrustedSource} property to true + and including the plugin from the \l{Qt Lottie Animation} module. Qt supports multiple options for displaying SVG files. For an overview and comparison of the different ones, see the documentation of the \l{svgtoqml} tool. diff --git a/tests/auto/qml/qqmllanguage/data/+FOO/Selected.qml b/tests/auto/qml/qqmllanguage/data/+FOO/Selected.qml new file mode 100644 index 0000000000..9369c645ef --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/+FOO/Selected.qml @@ -0,0 +1,5 @@ +import QtQml + +QtObject { + objectName: "green" +} diff --git a/tests/auto/qml/qqmllanguage/data/FileSelectorBase.qml b/tests/auto/qml/qqmllanguage/data/FileSelectorBase.qml new file mode 100644 index 0000000000..ee69ba9259 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/FileSelectorBase.qml @@ -0,0 +1,6 @@ +import QtQml + +QtObject { + objectName: test.objectName + property Selected test: Selected {} +} diff --git a/tests/auto/qml/qqmllanguage/data/Selected.qml b/tests/auto/qml/qqmllanguage/data/Selected.qml new file mode 100644 index 0000000000..ceba232a2c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/Selected.qml @@ -0,0 +1,5 @@ +import QtQml + +QtObject { + objectName: "blue" +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index d13a23ce61..1127081fe8 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -541,6 +541,8 @@ private slots: void listIsNotAType(); + void multiTypeResolution(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -10208,6 +10210,26 @@ void tst_qqmllanguage::listIsNotAType() "list is not a type. It requires an element type argument (eg. list<int>)"_L1)); } +void tst_qqmllanguage::multiTypeResolution() +{ + QQmlEngine engine1, engine2; + + QScopedPointer<QQmlFileSelector> fs(new QQmlFileSelector(&engine1)); + fs->setExtraSelectors({"FOO"}); + + QQmlComponent c1(&engine1, testFileUrl("FileSelectorBase.qml")); + QVERIFY2(c1.isReady(), qPrintable(c1.errorString())); + QScopedPointer<QObject> o1(c1.create()); + QVERIFY(o1); + QCOMPARE(o1->objectName(), "green"); + + QQmlComponent c2(&engine2, testFileUrl("FileSelectorBase.qml")); + QVERIFY2(c2.isReady(), qPrintable(c2.errorString())); + QScopedPointer<QObject> o2(c2.create()); + QVERIFY(o2); + QCOMPARE(o2->objectName(), "blue"); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index c28893da83..ac0bae2fd2 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -55,7 +55,7 @@ private slots: void signalHandlersAreCompatible(); void loadTypeOnShutdown(); void floodTypeLoaderEventQueue(); - void retainQmlTypeAcrossEngines(); + void doNotRetainQmlTypeAcrossEngines(); void loadLocalTypesAfterRemoteFails(); void populateDirectoryCache(); @@ -871,7 +871,7 @@ void tst_QQMLTypeLoader::floodTypeLoaderEventQueue() } } -void tst_QQMLTypeLoader::retainQmlTypeAcrossEngines() +void tst_QQMLTypeLoader::doNotRetainQmlTypeAcrossEngines() { QQmlEngine engine1; QQmlComponent component1(&engine1, testFileUrl("B.qml")); @@ -909,7 +909,8 @@ void tst_QQMLTypeLoader::retainQmlTypeAcrossEngines() const auto base2 = cu2->baseCompilationUnit(); const auto base3 = cu3->baseCompilationUnit(); - QCOMPARE(base1, base2); + // Each engine has its own base CU, too + QVERIFY(base1 != base2); QVERIFY(base1 != base3); QVERIFY(base2 != base3); @@ -923,8 +924,8 @@ void tst_QQMLTypeLoader::retainQmlTypeAcrossEngines() QVERIFY(mo1 != mo3); - // The base classes are all the same. - QCOMPARE(mo1->superClass(), mo3->superClass()); + // The base classes are also different. + QVERIFY(mo1->superClass() != mo3->superClass()); } class SingletonTypeExample : public QObject diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index b80aaba10c..7d18ad9014 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -4709,10 +4709,10 @@ void tst_QQuickTableView::leftRightTopBottomProperties_data() QTest::addColumn<QMargins>("expectedTable"); QTest::addColumn<QMargins>("expectedSignalCount"); - QTest::newRow("1") << QPointF(0, 0) << QMargins(0, 0, 5, 7) << QMargins(0, 0, 1, 1); - QTest::newRow("2") << QPointF(100, 50) << QMargins(1, 1, 6, 8) << QMargins(1, 1, 2, 2); - QTest::newRow("3") << QPointF(220, 120) << QMargins(2, 2, 8, 10) << QMargins(2, 2, 4, 4); - QTest::newRow("4") << QPointF(1000, 1000) << QMargins(9, 19, 15, 27) << QMargins(1, 1, 2, 2); + QTest::newRow("1") << QPointF(0, 0) << QMargins(0, 0, 5, 7) << QMargins(1, 1, 1, 1); + QTest::newRow("2") << QPointF(100, 50) << QMargins(1, 1, 6, 8) << QMargins(2, 2, 2, 2); + QTest::newRow("3") << QPointF(220, 120) << QMargins(2, 2, 8, 10) << QMargins(3, 3, 4, 4); + QTest::newRow("4") << QPointF(1000, 1000) << QMargins(9, 19, 15, 27) << QMargins(2, 2, 2, 2); } void tst_QQuickTableView::leftRightTopBottomProperties() |
