aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltype.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-02-06 17:18:09 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-11 10:13:31 +0000
commita4d6e0676f674bf907d7d33e59bd70b5d5d37da5 (patch)
tree5537acecffabbda0460f25819b9299e4aace0e07 /src/qml/qml/qqmltype.cpp
parente2fe9d537c8f86a2e1d9cbfaf801fe58f817e9c5 (diff)
Make QQmlTypePrivate::name safe for usage from different threads
There is hardly a point in setting this lazily. We always set uri and elementName together anyway. Change-Id: I5f9f00ee72d78fd8cf66413e81c8d88db1f8a436 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltype.cpp')
-rw-r--r--src/qml/qml/qqmltype.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp
index 2a1b4715d0..a4adb18f76 100644
--- a/src/qml/qml/qqmltype.cpp
+++ b/src/qml/qml/qqmltype.cpp
@@ -526,6 +526,12 @@ void QQmlTypePrivate::insertEnumsFromPropertyCache(const QQmlPropertyCache *cach
insertEnums(cppMetaObject);
}
+void QQmlTypePrivate::setName(const QString &uri, const QString &element)
+{
+ module = uri;
+ elementName = element;
+ name = uri.isEmpty() ? element : (uri + QLatin1Char('/') + element);
+}
QQmlPropertyCache *QQmlTypePrivate::propertyCacheForMinorVersion(int minorVersion) const
{
@@ -568,13 +574,6 @@ QString QQmlType::qmlTypeName() const
{
if (!d)
return QString();
- if (d->name.isEmpty()) {
- if (!d->module.isEmpty())
- d->name = static_cast<QString>(d->module) + QLatin1Char('/') + d->elementName;
- else
- d->name = d->elementName;
- }
-
return d->name;
}