summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-30 08:51:45 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-05 02:39:04 (GMT)
commit99cf375f554fe01cf47fd4e1a291d4bba62b4018 (patch)
tree4370a9921d21c3480a89a045f2ef7f88ba57bf26 /src
parentdff7f0593d86e90eb14c805a96ebbda778f45a82 (diff)
downloadQt-99cf375f554fe01cf47fd4e1a291d4bba62b4018.zip
Qt-99cf375f554fe01cf47fd4e1a291d4bba62b4018.tar.gz
Qt-99cf375f554fe01cf47fd4e1a291d4bba62b4018.tar.bz2
Minor QmlMetaProperty cleanup
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp53
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h2
2 files changed, 35 insertions, 20 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index ec143a7..fbe41dd 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -646,28 +646,11 @@ QVariant QmlMetaProperty::read() const
if (sig && sig->index() == d->coreIdx)
return sig->expression()->expression();
}
+
} else if (type() & Property) {
- if (type() & Attached) {
- return QVariant::fromValue(d->attachedObject());
- } else if(type() & ValueTypeProperty) {
- QmlEnginePrivate *ep = d->context?static_cast<QmlEnginePrivate *>(QObjectPrivate::get(d->context->engine())):0;
- QmlValueType *valueType = 0;
- if (ep)
- valueType = ep->valueTypes[d->valueTypeId];
- else
- valueType = QmlValueTypeFactory::valueType(d->valueTypeId);
- Q_ASSERT(valueType);
-
- valueType->read(object(), d->coreIdx);
- QVariant rv =
- valueType->metaObject()->property(d->valueTypeIdx).read(valueType);
- if (!ep)
- delete valueType;
- return rv;
- } else {
- return d->object->metaObject()->property(d->coreIdx).read(object());
- }
+ return d->readValueProperty();
+
}
return QVariant();
}
@@ -696,6 +679,36 @@ void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value)
}
}
+QVariant QmlMetaPropertyPrivate::readValueProperty()
+{
+ if (type & QmlMetaProperty::Attached) {
+
+ return QVariant::fromValue(attachedObject());
+
+ } else if(type & QmlMetaProperty::ValueTypeProperty) {
+
+ QmlEnginePrivate *ep = context?QmlEnginePrivate::get(context->engine()):0;
+ QmlValueType *valueType = 0;
+ if (ep)
+ valueType = ep->valueTypes[valueTypeId];
+ else
+ valueType = QmlValueTypeFactory::valueType(valueTypeId);
+ Q_ASSERT(valueType);
+
+ valueType->read(object, coreIdx);
+ QVariant rv =
+ valueType->metaObject()->property(valueTypeIdx).read(valueType);
+ if (!ep)
+ delete valueType;
+ return rv;
+
+ } else {
+
+ return object->metaObject()->property(coreIdx).read(object.data());
+
+ }
+}
+
void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
QmlMetaProperty::WriteSource source)
{
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index 0d96174..3193aaf 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -98,6 +98,8 @@ public:
QmlMetaProperty::PropertyCategory propertyCategory() const;
void writeSignalProperty(const QVariant &);
+
+ QVariant readValueProperty();
void writeValueProperty(const QVariant &, QmlMetaProperty::WriteSource);
static quint32 saveValueType(int, int);