summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 808ba68..1160ed8 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -957,7 +957,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
if (!data)
return 0; // Attached properties are only on objects created by QML
- QObject *rv = data->extendedData?data->attachedProperties()->value(id):0;
+ QObject *rv = data->hasExtendedData()?data->attachedProperties()->value(id):0;
if (rv || !create)
return rv;
@@ -985,6 +985,35 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create);
}
+class QDeclarativeDataExtended {
+public:
+ QDeclarativeDataExtended();
+ ~QDeclarativeDataExtended();
+
+ QHash<int, QObject *> attachedProperties;
+ QDeclarativeNotifier objectNameNotifier;
+};
+
+QDeclarativeDataExtended::QDeclarativeDataExtended()
+{
+}
+
+QDeclarativeDataExtended::~QDeclarativeDataExtended()
+{
+}
+
+QDeclarativeNotifier *QDeclarativeData::objectNameNotifier() const
+{
+ if (!extendedData) extendedData = new QDeclarativeDataExtended;
+ return &extendedData->objectNameNotifier;
+}
+
+QHash<int, QObject *> *QDeclarativeData::attachedProperties() const
+{
+ if (!extendedData) extendedData = new QDeclarativeDataExtended;
+ return &extendedData->attachedProperties;
+}
+
void QDeclarativeData::destroyed(QObject *object)
{
if (deferredComponent)
@@ -1075,28 +1104,6 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit)
bindingBits[bit / 32] |= (1 << (bit % 32));
}
-QDeclarativeData::ExtendedData::ExtendedData()
-: objectNameNotifier(0)
-{
-}
-
-QDeclarativeData::ExtendedData::~ExtendedData()
-{
- ((QDeclarativeNotifier *)&objectNameNotifier)->~QDeclarativeNotifier();
-}
-
-QDeclarativeNotifier *QDeclarativeData::objectNameNotifier() const
-{
- if (!extendedData) extendedData = new ExtendedData;
- return (QDeclarativeNotifier *)&extendedData->objectNameNotifier;
-}
-
-QHash<int, QObject *> *QDeclarativeData::attachedProperties() const
-{
- if (!extendedData) extendedData = new ExtendedData;
- return &extendedData->attachedProperties;
-}
-
/*!
Creates a QScriptValue allowing you to use \a object in QML script.
\a engine is the QDeclarativeEngine it is to be created in.