summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-22 07:26:45 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-22 07:26:45 (GMT)
commit6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930 (patch)
tree31616634bec2095cf16e82df9109cd6beda59460 /src/declarative/util
parentc4c12f947b0480fd0695e1885ebec9ab496f6bf4 (diff)
downloadQt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.zip
Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.gz
Qt-6b2e0b4c5851a156c1f5fa0f73e9b1266ddc6930.tar.bz2
Preliminary support for object and list synthesized property types
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmllistaccessor.cpp13
-rw-r--r--src/declarative/util/qmllistaccessor.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 1228952..ef21ebf 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -44,6 +44,9 @@
#include <qmlmetatype.h>
#include <QtCore/qdebug.h>
+// ### Remove me
+#include <private/qmlengine_p.h>
+
QT_BEGIN_NAMESPACE
QmlListAccessor::QmlListAccessor()
@@ -60,10 +63,12 @@ QVariant QmlListAccessor::list() const
return d;
}
-void QmlListAccessor::setList(const QVariant &v)
+void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
{
d = v;
+ QmlEnginePrivate *enginePrivate = engine?QmlEnginePrivate::get(engine):0;
+
if (!d.isValid()) {
m_type = Invalid;
} else if (d.type() == QVariant::StringList) {
@@ -75,12 +80,14 @@ void QmlListAccessor::setList(const QVariant &v)
m_type = Integer;
} else if (d.type() != QVariant::UserType) {
m_type = Instance;
- } else if (QmlMetaType::isObject(d.userType())) {
+ } else if ((!enginePrivate && QmlMetaType::isObject(d.userType())) ||
+ (enginePrivate && enginePrivate->isObject(d.userType()))) {
QObject *data = 0;
data = *(QObject **)v.constData();
d = QVariant::fromValue(data);
m_type = Instance;
- } else if (QmlMetaType::isQmlList(d.userType())) {
+ } else if ((!enginePrivate && QmlMetaType::isQmlList(d.userType())) ||
+ (enginePrivate && enginePrivate->isQmlList(d.userType()))) {
m_type = QmlList;
} else if (QmlMetaType::isList(d.userType())) {
qDebug() << "list";
diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor.h
index f0d293f..c3ff632 100644
--- a/src/declarative/util/qmllistaccessor.h
+++ b/src/declarative/util/qmllistaccessor.h
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QmlEngine;
class Q_DECLARATIVE_EXPORT QmlListAccessor
{
public:
@@ -57,7 +58,7 @@ public:
virtual ~QmlListAccessor();
QVariant list() const;
- void setList(const QVariant &);
+ void setList(const QVariant &, QmlEngine * = 0);
bool isValid() const;