diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-12 04:11:22 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-12 04:11:22 (GMT) |
commit | 2d4db45fabb68d380b34eb5b2922357ebd26b94c (patch) | |
tree | a786fa8d15742d8af25b03b97427814fb29b3615 /src/declarative/qml/qmlvaluetype.cpp | |
parent | 80b7c8439172e53b7231abf73ac534c86680b309 (diff) | |
download | Qt-2d4db45fabb68d380b34eb5b2922357ebd26b94c.zip Qt-2d4db45fabb68d380b34eb5b2922357ebd26b94c.tar.gz Qt-2d4db45fabb68d380b34eb5b2922357ebd26b94c.tar.bz2 |
Add QSize/QSizeF value types.
Diffstat (limited to 'src/declarative/qml/qmlvaluetype.cpp')
-rw-r--r-- | src/declarative/qml/qmlvaluetype.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp index b827572..dada8ff 100644 --- a/src/declarative/qml/qmlvaluetype.cpp +++ b/src/declarative/qml/qmlvaluetype.cpp @@ -63,6 +63,10 @@ QmlValueType *QmlValueTypeFactory::valueType(int t) return new QmlPointValueType; case QVariant::PointF: return new QmlPointFValueType; + case QVariant::Size: + return new QmlSizeValueType; + case QVariant::SizeF: + return new QmlSizeFValueType; case QVariant::Rect: return new QmlRectValueType; case QVariant::RectF: @@ -153,6 +157,80 @@ void QmlPointValueType::setY(int y) point.setY(y); } +QmlSizeFValueType::QmlSizeFValueType(QObject *parent) +: QmlValueType(parent) +{ +} + +void QmlSizeFValueType::read(QObject *obj, int idx) +{ + void *a[] = { &size, 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); +} + +void QmlSizeFValueType::write(QObject *obj, int idx) +{ + void *a[] = { &size, 0 }; + QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a); +} + +qreal QmlSizeFValueType::width() const +{ + return size.width(); +} + +qreal QmlSizeFValueType::height() const +{ + return size.height(); +} + +void QmlSizeFValueType::setWidth(qreal w) +{ + size.setWidth(w); +} + +void QmlSizeFValueType::setHeight(qreal h) +{ + size.setHeight(h); +} + +QmlSizeValueType::QmlSizeValueType(QObject *parent) +: QmlValueType(parent) +{ +} + +void QmlSizeValueType::read(QObject *obj, int idx) +{ + void *a[] = { &size, 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); +} + +void QmlSizeValueType::write(QObject *obj, int idx) +{ + void *a[] = { &size, 0 }; + QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a); +} + +int QmlSizeValueType::width() const +{ + return size.width(); +} + +int QmlSizeValueType::height() const +{ + return size.height(); +} + +void QmlSizeValueType::setWidth(int w) +{ + size.setWidth(w); +} + +void QmlSizeValueType::setHeight(int h) +{ + size.setHeight(h); +} + QmlRectFValueType::QmlRectFValueType(QObject *parent) : QmlValueType(parent) { |