From 9dc9424d1873b1bc3b5ed056d4dda7f6c76e15ae Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Jul 2017 09:44:05 +0200 Subject: Fix linking if apps using QQmlPropertyMap when using version scripts Avoid the use of the QObject constructor that takes a QObjectPrivate in the inline QQmlPropertyMap constructor. Task-number: QTBUG-46433 Change-Id: I62e3c80e28334ce5a4c3d2249abfada45a8dccb3 Reviewed-by: Thiago Macieira --- src/qml/util/qqmlpropertymap.cpp | 12 +++--------- src/qml/util/qqmlpropertymap.h | 6 ++---- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index 6e6554f2c3..b54e8d901a 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -186,9 +186,8 @@ int QQmlPropertyMapMetaObject::createProperty(const char *name, const char *valu Constructs a bindable map with parent object \a parent. */ QQmlPropertyMap::QQmlPropertyMap(QObject *parent) -: QObject(*allocatePrivate(), parent) +: QQmlPropertyMap(&staticMetaObject, parent) { - init(metaObject()); } /*! @@ -339,18 +338,13 @@ QVariant QQmlPropertyMap::updateValue(const QString &key, const QVariant &input) } /*! \internal */ -void QQmlPropertyMap::init(const QMetaObject *staticMetaObject) +QQmlPropertyMap::QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *parent) + : QObject(*(new QQmlPropertyMapPrivate), parent) { Q_D(QQmlPropertyMap); d->mo = new QQmlPropertyMapMetaObject(this, d, staticMetaObject); } -/*! \internal */ -QObjectPrivate *QQmlPropertyMap::allocatePrivate() -{ - return new QQmlPropertyMapPrivate; -} - /*! \fn void QQmlPropertyMap::valueChanged(const QString &key, const QVariant &value) This signal is emitted whenever one of the values in the map is changed. \a key diff --git a/src/qml/util/qqmlpropertymap.h b/src/qml/util/qqmlpropertymap.h index 01048f3662..8c5ecce48e 100644 --- a/src/qml/util/qqmlpropertymap.h +++ b/src/qml/util/qqmlpropertymap.h @@ -80,15 +80,13 @@ protected: template QQmlPropertyMap(DerivedType *derived, QObject *parentObj) - : QObject(*allocatePrivate(), parentObj) + : QQmlPropertyMap(&DerivedType::staticMetaObject, parentObj) { Q_UNUSED(derived) - init(&DerivedType::staticMetaObject); } private: - void init(const QMetaObject *staticMetaObject); - static QObjectPrivate *allocatePrivate(); + QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *parent); Q_DECLARE_PRIVATE(QQmlPropertyMap) Q_DISABLE_COPY(QQmlPropertyMap) -- cgit v1.2.3 From db1034d093d76b4b6e66fcdd178800e0cf9d1005 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 23 Jun 2017 12:10:23 +0200 Subject: Move the engine pointer from the property cache to the VME meta object This is where it belongs, and it makes the PropertyCache independent of the engine used. Task-number: QTBUG-61536 Change-Id: I21c2674ee3e2895abd2418764d140b154b47b868 Reviewed-by: Simon Hausmann --- src/qml/util/qqmladaptormodel.cpp | 15 ++++++--------- src/qml/util/qqmladaptormodel_p.h | 5 ++--- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index d4aa2e19ed..2d93c331cc 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -515,16 +515,15 @@ public: QQmlDelegateModelItem *createItem( QQmlAdaptorModel &model, QQmlDelegateModelItemMetaType *metaType, - QQmlEngine *engine, - int index) const + int index) const Q_DECL_OVERRIDE { VDMAbstractItemModelDataType *dataType = const_cast(this); if (!metaObject) - dataType->initializeMetaType(model, engine); + dataType->initializeMetaType(model); return new QQmlDMAbstractItemModelData(metaType, dataType, index); } - void initializeMetaType(QQmlAdaptorModel &model, QQmlEngine *engine) + void initializeMetaType(QQmlAdaptorModel &model) { QMetaObjectBuilder builder; setModelDataType(&builder, this); @@ -549,7 +548,7 @@ public: metaObject = builder.toMetaObject(); *static_cast(this) = *metaObject; - propertyCache = new QQmlPropertyCache(QV8Engine::getV4(engine), metaObject); + propertyCache = new QQmlPropertyCache(metaObject); } }; @@ -661,8 +660,7 @@ public: QQmlDelegateModelItem *createItem( QQmlAdaptorModel &model, QQmlDelegateModelItemMetaType *metaType, - QQmlEngine *, - int index) const + int index) const Q_DECL_OVERRIDE { return new QQmlDMListAccessorData( metaType, @@ -746,8 +744,7 @@ public: QQmlDelegateModelItem *createItem( QQmlAdaptorModel &model, QQmlDelegateModelItemMetaType *metaType, - QQmlEngine *, - int index) const + int index) const Q_DECL_OVERRIDE { VDMObjectDelegateDataType *dataType = const_cast(this); if (!metaObject) diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 78d964236e..7bbddcff07 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -82,7 +82,6 @@ public: virtual QQmlDelegateModelItem *createItem( QQmlAdaptorModel &, QQmlDelegateModelItemMetaType *, - QQmlEngine *, int) const { return 0; } virtual bool notify( @@ -122,8 +121,8 @@ public: inline int count() const { return qMax(0, accessors->count(*this)); } inline QVariant value(int index, const QString &role) const { return accessors->value(*this, index, role); } - inline QQmlDelegateModelItem *createItem(QQmlDelegateModelItemMetaType *metaType, QQmlEngine *engine, int index) { - return accessors->createItem(*this, metaType, engine, index); } + inline QQmlDelegateModelItem *createItem(QQmlDelegateModelItemMetaType *metaType, int index) { + return accessors->createItem(*this, metaType, index); } inline bool hasProxyObject() const { return list.type() == QQmlListAccessor::Instance || list.type() == QQmlListAccessor::ListProperty; } -- cgit v1.2.3