diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-06-26 18:02:35 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-11 01:46:52 +0200 |
commit | f5cb65b35e076facbce45e896902a34da7036135 (patch) | |
tree | 7575065fde2d0c14c379a992bf8b3593e21f4881 /tests/auto/qml/qqmlqt/data | |
parent | 5376906de58e1c25c77b7a61800365b6e542542f (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 'tests/auto/qml/qqmlqt/data')
-rw-r--r-- | tests/auto/qml/qqmlqt/data/font.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qqmlqt/data/matrix4x4.qml | 9 | ||||
-rw-r--r-- | tests/auto/qml/qqmlqt/data/quaternion.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qqmlqt/data/vector2.qml | 8 |
4 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlqt/data/font.qml b/tests/auto/qml/qqmlqt/data/font.qml new file mode 100644 index 0000000000..9ebf460caf --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/font.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.font({ family: "Arial", pointSize: 22 }); + property variant test2: Qt.font({ family: "Arial", pointSize: 20, weight: Font.DemiBold, italic: true }); + property variant test3: Qt.font("Arial", 22); + property variant test4: Qt.font({ something: "Arial", other: 22 }); +} diff --git a/tests/auto/qml/qqmlqt/data/matrix4x4.qml b/tests/auto/qml/qqmlqt/data/matrix4x4.qml new file mode 100644 index 0000000000..0185fcb635 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/matrix4x4.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.matrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + property variant test2: Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4]); + property variant test3: Qt.matrix4x4(1,2,3,4,5,6); + property variant test4: Qt.matrix4x4([1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5]); + property variant test5: Qt.matrix4x4({ test: 5, subprop: "hello" }); +} diff --git a/tests/auto/qml/qqmlqt/data/quaternion.qml b/tests/auto/qml/qqmlqt/data/quaternion.qml new file mode 100644 index 0000000000..6203bd1e32 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/quaternion.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.quaternion(2, 17, 0.9, 0.6); + property variant test2: Qt.quaternion(102, -10, -982.1, 10); + property variant test3: Qt.quaternion(102, -10, -982.1); + property variant test4: Qt.quaternion(102, -10, -982.1, 10, 15); +} diff --git a/tests/auto/qml/qqmlqt/data/vector2.qml b/tests/auto/qml/qqmlqt/data/vector2.qml new file mode 100644 index 0000000000..1ca513eaba --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/vector2.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + property variant test1: Qt.vector2d(1, 0.9); + property variant test2: Qt.vector2d(102, -982.1); + property variant test3: Qt.vector2d(102); + property variant test4: Qt.vector2d(102, -982.1, 10); +} |