aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetype.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-06-26 18:02:35 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-11 01:46:52 +0200
commitf5cb65b35e076facbce45e896902a34da7036135 (patch)
tree7575065fde2d0c14c379a992bf8b3593e21f4881 /src/qml/qml/qqmlvaluetype.cpp
parent5376906de58e1c25c77b7a61800365b6e542542f (diff)
Fix broken value-type support by allowing property definition
In QtQuick 1.x the "variant" property type was supported, which could be used to allow value type properties to be defined in QML. In QtQuick 2.0, we have deprecated the "variant" property, but its replacement ("var") is not suited for defining lightweight C++ type values (such as QColor, QFont, QRectF, QVector3D etc). This commit allows those QML basic types to be used in QML once more, by supporting them in the property definition syntax. Note that since some value types are provided by QtQuick and others are provided by QtQml, if a client imports only QtQml they can define but not use properties of certain types (eg, font). Task-number: QTBUG-21034 Task-number: QTBUG-18217 Change-Id: Ia951a8522f223408d27293bb96c276281a710277 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvaluetype.cpp')
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index c0759a31b4..165024adfe 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -112,14 +112,14 @@ QQmlValueType *QQmlValueTypeFactory::valueType(int t)
return rv;
}
-QQmlValueType::QQmlValueType(QObject *parent)
-: QObject(parent)
+QQmlValueType::QQmlValueType(int userType, QObject *parent)
+: QObject(parent), m_userType(userType)
{
}
QQmlPointFValueType::QQmlPointFValueType(QObject *parent)
- : QQmlValueTypeBase<QPointF>(parent)
+ : QQmlValueTypeBase<QPointF>(QMetaType::QPointF, parent)
{
}
@@ -150,7 +150,7 @@ void QQmlPointFValueType::setY(qreal y)
QQmlPointValueType::QQmlPointValueType(QObject *parent)
- : QQmlValueTypeBase<QPoint>(parent)
+ : QQmlValueTypeBase<QPoint>(QMetaType::QPoint, parent)
{
}
@@ -181,7 +181,7 @@ void QQmlPointValueType::setY(int y)
QQmlSizeFValueType::QQmlSizeFValueType(QObject *parent)
- : QQmlValueTypeBase<QSizeF>(parent)
+ : QQmlValueTypeBase<QSizeF>(QMetaType::QSizeF, parent)
{
}
@@ -212,7 +212,7 @@ void QQmlSizeFValueType::setHeight(qreal h)
QQmlSizeValueType::QQmlSizeValueType(QObject *parent)
- : QQmlValueTypeBase<QSize>(parent)
+ : QQmlValueTypeBase<QSize>(QMetaType::QSize, parent)
{
}
@@ -243,7 +243,7 @@ void QQmlSizeValueType::setHeight(int h)
QQmlRectFValueType::QQmlRectFValueType(QObject *parent)
- : QQmlValueTypeBase<QRectF>(parent)
+ : QQmlValueTypeBase<QRectF>(QMetaType::QRectF, parent)
{
}
@@ -294,7 +294,7 @@ void QQmlRectFValueType::setHeight(qreal h)
QQmlRectValueType::QQmlRectValueType(QObject *parent)
- : QQmlValueTypeBase<QRect>(parent)
+ : QQmlValueTypeBase<QRect>(QMetaType::QRect, parent)
{
}
@@ -345,7 +345,7 @@ void QQmlRectValueType::setHeight(int h)
QQmlEasingValueType::QQmlEasingValueType(QObject *parent)
- : QQmlValueTypeBase<QEasingCurve>(parent)
+ : QQmlValueTypeBase<QEasingCurve>(QMetaType::QEasingCurve, parent)
{
}