diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-06-22 09:43:05 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-24 10:13:39 +0200 |
commit | 1b7a098803a43355abf62e099267d4a122645e07 (patch) | |
tree | bd8f744e81250042d3e86c1c942be89e8e292f31 /src/qml/common | |
parent | ae36d94c2f385e272ae25fcd0fe780edb70cf7d9 (diff) |
Unify "variant" and "var" properties in QML
variant and var properties differ in two important ways:
- variant properties trigger "magic" string conversions:
variant v1: "red" // contains a QColor
var v2: "red" // contains a string
- variant properties behave differently for value types: they create
copies, instead of references.
However, as variant properties were marked as obsolete and this
behavior was effetively undocumented, it should be safe to give "variant"
"var semantics".
With this change, we can also avoid doing magic conversions when storing
data in QVariant properties of QObjects/QGadgets
Change-Id: I549b1beb98e6af9639c1ee81f316bda513d5ff65
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/common')
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index 8c4aa1b12e..d46fd58bc8 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE // Also change the comment behind the number to describe the latest change. This has the added // benefit that if another patch changes the version too, it will result in a merge conflict, and // not get removed silently. -#define QV4_DATA_STRUCTURE_VERSION 0x30// support additional required property features +#define QV4_DATA_STRUCTURE_VERSION 0x31// removed builtin variant type class QIODevice; class QQmlTypeNameCache; @@ -247,7 +247,7 @@ struct Block static_assert(sizeof(Block) == 12, "Block structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); enum class BuiltinType : unsigned int { - Var = 0, Variant, Int, Bool, Real, String, Url, Color, + Var = 0, Int, Bool, Real, String, Url, Color, Font, Time, Date, DateTime, Rect, Point, Size, Vector2D, Vector3D, Vector4D, Matrix4x4, Quaternion, InvalidBuiltin }; |