diff options
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlfile.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlglobal.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlglobal_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlplatform.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlplatform_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 41 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader_p.h | 12 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 26 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 4 |
12 files changed, 83 insertions, 32 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 4a21acb050..fd516c9815 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -449,6 +449,12 @@ The following functions are also on the Qt object. \li \c "windows" - Windows \li \c "winrt" - WinRT / UWP \endlist + + \row + \li \c platform.pluginName + \li This is the name of the platform set on the QGuiApplication instance + as returned by \l QGuiApplication::platformName() + \endtable */ @@ -590,7 +596,7 @@ The following functions are also on the Qt object. \li application.font \endlist - \sa Screen, Window, Window.screen + \sa Screen, Window, {QtQuick::Window::screen}{Window.screen} */ /*! diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp index 4e4db086b0..93c3e8e00c 100644 --- a/src/qml/qml/qqmlfile.cpp +++ b/src/qml/qml/qqmlfile.cpp @@ -603,6 +603,12 @@ empty string. */ QString QQmlFile::urlToLocalFileOrQrc(const QString& url) { + if (url.startsWith(QLatin1String("qrc://"), Qt::CaseInsensitive)) { + if (url.length() > 6) + return QLatin1Char(':') + url.midRef(6); + return QString(); + } + if (url.startsWith(QLatin1String("qrc:"), Qt::CaseInsensitive)) { if (url.length() > 4) return QLatin1Char(':') + url.midRef(4); diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp index 7939656107..6418812bae 100644 --- a/src/qml/qml/qqmlglobal.cpp +++ b/src/qml/qml/qqmlglobal.cpp @@ -343,6 +343,8 @@ QObject *QQmlGuiProvider::styleHints() return o; } +QString QQmlGuiProvider::pluginName() const { return QString(); } + static QQmlGuiProvider *guiProvider = 0; Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *newProvider) diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index 707814e781..a6c113f5a7 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -311,6 +311,7 @@ public: virtual QObject *styleHints(); virtual QStringList fontFamilies(); virtual bool openUrlExternally(QUrl &); + virtual QString pluginName() const; }; Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *); diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp index 165cde5eb3..a8c402af2e 100644 --- a/src/qml/qml/qqmlplatform.cpp +++ b/src/qml/qml/qqmlplatform.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qqmlplatform_p.h" +#include "qqmlglobal_p.h" QT_BEGIN_NAMESPACE @@ -78,6 +79,11 @@ QString QQmlPlatform::os() #endif } +QString QQmlPlatform::pluginName() const +{ + return QQml_guiProvider()->pluginName(); +} + QT_END_NAMESPACE #include "moc_qqmlplatform_p.cpp" diff --git a/src/qml/qml/qqmlplatform_p.h b/src/qml/qml/qqmlplatform_p.h index 6887720adb..6246ca7105 100644 --- a/src/qml/qml/qqmlplatform_p.h +++ b/src/qml/qml/qqmlplatform_p.h @@ -61,12 +61,14 @@ class Q_QML_PRIVATE_EXPORT QQmlPlatform : public QObject { Q_OBJECT Q_PROPERTY(QString os READ os CONSTANT) + Q_PROPERTY(QString pluginName READ pluginName CONSTANT) public: explicit QQmlPlatform(QObject *parent = 0); virtual ~QQmlPlatform(); static QString os(); + QString pluginName() const; private: Q_DISABLE_COPY(QQmlPlatform) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 88ce2fa1b9..d18159841c 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -970,8 +970,11 @@ int QQmlPropertyCache::originalClone(QObject *object, int index) QQmlData *data = QQmlData::get(object, false); if (data && data->propertyCache) { QQmlPropertyCache *cache = data->propertyCache; - while (cache->signal(index)->isCloned()) + QQmlPropertyData *sig = cache->signal(index); + while (sig && sig->isCloned()) { --index; + sig = cache->signal(index); + } } else { while (QMetaObjectPrivate::signal(object->metaObject(), index).attributes() & QMetaMethod::Cloned) --index; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 40bd2e5020..e4293596d8 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1320,8 +1320,8 @@ bool QQmlTypeLoader::Blob::fetchQmldir(const QUrl &url, const QV4::CompiledData: { QQmlQmldirData *data = typeLoader()->getQmldir(url); - data->setImport(import); - data->setPriority(priority); + data->setImport(this, import); + data->setPriority(this, priority); if (data->status() == Error) { // This qmldir must not exist - which is not an error @@ -1349,7 +1349,7 @@ bool QQmlTypeLoader::Blob::updateQmldir(QQmlQmldirData *data, const QV4::Compile QHash<const QV4::CompiledData::Import *, int>::iterator it = m_unresolvedImports.find(import); if (it != m_unresolvedImports.end()) { - *it = data->priority(); + *it = data->priority(this); } // Release this reference at destruction @@ -1482,7 +1482,7 @@ void QQmlTypeLoader::Blob::dependencyComplete(QQmlDataBlob *blob) if (blob->type() == QQmlDataBlob::QmldirFile) { QQmlQmldirData *data = static_cast<QQmlQmldirData *>(blob); - const QV4::CompiledData::Import *import = data->import(); + const QV4::CompiledData::Import *import = data->import(this); QList<QQmlError> errors; if (!qmldirDataAvailable(data, &errors)) { @@ -1506,11 +1506,11 @@ bool QQmlTypeLoader::Blob::qmldirDataAvailable(QQmlQmldirData *data, QList<QQmlE { bool resolve = true; - const QV4::CompiledData::Import *import = data->import(); - data->setImport(0); + const QV4::CompiledData::Import *import = data->import(this); + data->setImport(this, 0); - int priority = data->priority(); - data->setPriority(0); + int priority = data->priority(this); + data->setPriority(this, 0); if (import) { // Do we need to resolve this import? @@ -3069,7 +3069,7 @@ void QQmlScriptBlob::initializeFromCompilationUnit(QV4::CompiledData::Compilatio } QQmlQmldirData::QQmlQmldirData(const QUrl &url, QQmlTypeLoader *loader) -: QQmlTypeLoader::Blob(url, QmldirFile, loader), m_import(0), m_priority(0) +: QQmlTypeLoader::Blob(url, QmldirFile, loader) { } @@ -3078,24 +3078,31 @@ const QString &QQmlQmldirData::content() const return m_content; } -const QV4::CompiledData::Import *QQmlQmldirData::import() const +const QV4::CompiledData::Import *QQmlQmldirData::import(QQmlTypeLoader::Blob *blob) const { - return m_import; + QHash<QQmlTypeLoader::Blob *, const QV4::CompiledData::Import *>::const_iterator it = + m_imports.find(blob); + if (it == m_imports.end()) + return 0; + return *it; } -void QQmlQmldirData::setImport(const QV4::CompiledData::Import *import) +void QQmlQmldirData::setImport(QQmlTypeLoader::Blob *blob, const QV4::CompiledData::Import *import) { - m_import = import; + m_imports[blob] = import; } -int QQmlQmldirData::priority() const +int QQmlQmldirData::priority(QQmlTypeLoader::Blob *blob) const { - return m_priority; + QHash<QQmlTypeLoader::Blob *, int>::const_iterator it = m_priorities.find(blob); + if (it == m_priorities.end()) + return 0; + return *it; } -void QQmlQmldirData::setPriority(int priority) +void QQmlQmldirData::setPriority(QQmlTypeLoader::Blob *blob, int priority) { - m_priority = priority; + m_priorities[blob] = priority; } void QQmlQmldirData::dataReceived(const SourceCodeData &data) diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 48e7d5cba4..f367fa6f58 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -572,11 +572,11 @@ private: public: const QString &content() const; - const QV4::CompiledData::Import *import() const; - void setImport(const QV4::CompiledData::Import *); + const QV4::CompiledData::Import *import(QQmlTypeLoader::Blob *) const; + void setImport(QQmlTypeLoader::Blob *, const QV4::CompiledData::Import *); - int priority() const; - void setPriority(int); + int priority(QQmlTypeLoader::Blob *) const; + void setPriority(QQmlTypeLoader::Blob *, int); protected: void dataReceived(const SourceCodeData &) override; @@ -584,8 +584,8 @@ protected: private: QString m_content; - const QV4::CompiledData::Import *m_import; - int m_priority; + QHash<QQmlTypeLoader::Blob *, const QV4::CompiledData::Import *> m_imports; + QHash<QQmlTypeLoader::Blob *, int> m_priorities; }; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index d262b230e2..ce47ab9fa9 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -51,9 +51,11 @@ #include <private/qv4alloca_p.h> #include <private/qv4objectiterator_p.h> #include <private/qv4qobjectwrapper_p.h> +#include <QtCore/qloggingcategory.h> QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcBindingRemoval) DEFINE_OBJECT_VTABLE(QV4::QQmlValueTypeWrapper); @@ -438,6 +440,9 @@ bool QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value) if (reference) { QV4::ScopedFunctionObject f(scope, value); + const QQmlQPointer<QObject> &referenceObject = reference->d()->object; + const int referencePropertyIndex = reference->d()->property; + if (f) { if (!f->isBinding()) { // assigning a JS function to a non-var-property is not allowed. @@ -452,18 +457,31 @@ bool QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value) QQmlPropertyData cacheData; cacheData.setWritable(true); cacheData.setPropType(writeBackPropertyType); - cacheData.setCoreIndex(reference->d()->property); + cacheData.setCoreIndex(referencePropertyIndex); QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f); QV4::ScopedContext ctx(scope, bindingFunction->scope()); - QQmlBinding *newBinding = QQmlBinding::create(&cacheData, bindingFunction->function(), reference->d()->object, context, ctx); + QQmlBinding *newBinding = QQmlBinding::create(&cacheData, bindingFunction->function(), referenceObject, context, ctx); newBinding->setSourceLocation(bindingFunction->currentLocation()); - newBinding->setTarget(reference->d()->object, cacheData, pd); + newBinding->setTarget(referenceObject, cacheData, pd); QQmlPropertyPrivate::setBinding(newBinding); return true; } else { - QQmlPropertyPrivate::removeBinding(reference->d()->object, QQmlPropertyIndex(reference->d()->property, pd->coreIndex())); + if (Q_UNLIKELY(lcBindingRemoval().isInfoEnabled())) { + if (auto binding = QQmlPropertyPrivate::binding(referenceObject, QQmlPropertyIndex(referencePropertyIndex, pd->coreIndex()))) { + Q_ASSERT(!binding->isValueTypeProxy()); + const auto qmlBinding = static_cast<const QQmlBinding*>(binding); + const auto stackFrame = v4->currentStackFrame(); + qCInfo(lcBindingRemoval, + "Overwriting binding on %s::%s which was initially bound at %s by setting \"%s\" at %s:%d", + referenceObject->metaObject()->className(), referenceObject->metaObject()->property(referencePropertyIndex).name(), + qPrintable(qmlBinding->expressionIdentifier()), + metaObject->property(pd->coreIndex()).name(), + qPrintable(stackFrame.source), stackFrame.line); + } + } + QQmlPropertyPrivate::removeBinding(referenceObject, QQmlPropertyIndex(referencePropertyIndex, pd->coreIndex())); } } diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 9f86d1cae9..a2ab9bdfed 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -105,7 +105,7 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *) QV4::Scope scope(v4); QV4::Scoped<QV4::MemberData> sp(scope, m_target->propertyAndMethodStorage.value()); if (sp) { - QV4::MemberData::Index index{ sp->d(), static_cast<uint>(m_index) }; + QV4::MemberData::Index index{ sp->d(), sp->d()->values.values + m_index }; index.set(v4, QV4::Primitive::nullValue()); } } diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index b18904fc73..9e8735cbc6 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -895,7 +895,7 @@ ReturnedValue NamedNodeMap::get(const Managed *m, String *name, bool *hasPropert const NamedNodeMap *r = static_cast<const NamedNodeMap *>(m); QV4::ExecutionEngine *v4 = r->engine(); - name->makeIdentifier(v4); + name->makeIdentifier(); if (name->equals(v4->id_length())) return Primitive::fromInt32(r->d()->list().count()).asReturnedValue(); @@ -940,7 +940,7 @@ ReturnedValue NodeList::get(const Managed *m, String *name, bool *hasProperty) const NodeList *r = static_cast<const NodeList *>(m); QV4::ExecutionEngine *v4 = r->engine(); - name->makeIdentifier(v4); + name->makeIdentifier(); if (name->equals(v4->id_length())) return Primitive::fromInt32(r->d()->d->children.count()).asReturnedValue(); |