diff options
author | Liang Qi <liang.qi@qt.io> | 2019-01-22 10:35:09 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-01-22 11:20:29 +0100 |
commit | 1b4d2741f90d3f4daf79940b9c8713dda0fb7f3d (patch) | |
tree | 40cee4f6af7bf9a5fc87c43f024f417a5d09e18d /src/qml/qml | |
parent | 536868fad50778ec5bf4c6c7269c721b05d8a2d5 (diff) | |
parent | 84e15a609b37a64baf82ed20f8d4f79474989226 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
.qmake.conf
tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
Change-Id: Ic1f5e219a255d0613f7654368a5ce3eccb8f0ee9
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 13 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmllist.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 16 |
5 files changed, 28 insertions, 19 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 024ec29a56..a949df4968 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -517,11 +517,14 @@ QVariant QQmlBinding::evaluate() QString QQmlBinding::expressionIdentifier() const { - auto f = function(); - QString url = f->sourceFile(); - quint16 lineNumber = f->compiledFunction->location.line; - quint16 columnNumber = f->compiledFunction->location.column; - return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber)); + if (auto f = function()) { + QString url = f->sourceFile(); + quint16 lineNumber = f->compiledFunction->location.line; + quint16 columnNumber = f->compiledFunction->location.column; + return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber)); + } + + return QStringLiteral("[native code]"); } void QQmlBinding::expressionChanged() diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 5ed3cc5d6a..57ea685a5d 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -756,12 +756,12 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent) } /*! - Create an object instance from this component. Returns 0 if creation + Create an object instance from this component. Returns \nullptr if creation failed. \a context specifies the context within which to create the object instance. - If \a context is 0 (the default), it will create the instance in the - engine' s \l {QQmlEngine::rootContext()}{root context}. + If \a context is \nullptr (the default), it will create the instance in the + \l {QQmlEngine::rootContext()}{root context} of the engine. The ownership of the returned object instance is transferred to the caller. @@ -791,7 +791,7 @@ QObject *QQmlComponent::create(QQmlContext *context) In general, programmers should use QQmlComponent::create() to create object instances. - Create an object instance from this component. Returns 0 if creation + Create an object instance from this component. Returns \nullptr if creation failed. \a publicContext specifies the context within which to create the object instance. diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 6db43a50eb..5841a480fc 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1304,9 +1304,7 @@ void QQmlEngine::addImageProvider(const QString &providerId, QQmlImageProviderBa } /*! - Returns the image provider set for \a providerId. - - Returns the provider if it was found; otherwise returns 0. + Returns the image provider set for \a providerId if found; otherwise returns \nullptr. \sa QQuickImageProvider */ diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp index 656a8a470b..5425bf498c 100644 --- a/src/qml/qml/qqmllist.cpp +++ b/src/qml/qml/qqmllist.cpp @@ -184,7 +184,7 @@ bool QQmlListReference::isValid() const } /*! -Returns the list property's object. Returns 0 if the reference is invalid. +Returns the list property's object. Returns \nullptr if the reference is invalid. */ QObject *QQmlListReference::object() const { @@ -193,8 +193,8 @@ QObject *QQmlListReference::object() const } /*! -Returns the QMetaObject for the elements stored in the list property. Returns 0 if the reference -is invalid. +Returns the QMetaObject for the elements stored in the list property, +or \nullptr if the reference is invalid. The QMetaObject can be used ahead of time to determine whether a given instance can be added to a list. diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index c05ae27b93..032ee7d6fc 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -497,9 +497,9 @@ QQmlType::QQmlType(QQmlMetaTypeData *data, const QString &elementName, const QQm d->extraData.cd->attachedPropertiesFunc = type.attachedPropertiesFunction; d->extraData.cd->attachedPropertiesType = type.attachedPropertiesMetaObject; if (d->extraData.cd->attachedPropertiesType) { - QHash<const QMetaObject *, int>::Iterator iter = d->attachedPropertyIds.find(d->baseMetaObject); - if (iter == d->attachedPropertyIds.end()) - iter = d->attachedPropertyIds.insert(d->baseMetaObject, d->index); + auto iter = QQmlTypePrivate::attachedPropertyIds.find(d->baseMetaObject); + if (iter == QQmlTypePrivate::attachedPropertyIds.end()) + iter = QQmlTypePrivate::attachedPropertyIds.insert(d->baseMetaObject, d->index); d->extraData.cd->attachedPropertiesId = *iter; } else { d->extraData.cd->attachedPropertiesId = -1; @@ -569,8 +569,16 @@ QQmlType::QQmlType(QQmlTypePrivate *priv) QQmlType::~QQmlType() { - if (d && !d->refCount.deref()) + if (d && !d->refCount.deref()) { + // If attached properties were successfully registered, deregister them. + // (They may not have been registered if some other type used the same baseMetaObject) + if (d->regType == CppType && d->extraData.cd->attachedPropertiesType) { + auto it = QQmlTypePrivate::attachedPropertyIds.find(d->baseMetaObject); + if (it != QQmlTypePrivate::attachedPropertyIds.end() && *it == d->index) + QQmlTypePrivate::attachedPropertyIds.erase(it); + } delete d; + } } QHashedString QQmlType::module() const |