aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlstringconverters.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-06-22 09:43:05 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-08-24 10:13:39 +0200
commit1b7a098803a43355abf62e099267d4a122645e07 (patch)
treebd8f744e81250042d3e86c1c942be89e8e292f31 /src/qml/qml/qqmlstringconverters.cpp
parentae36d94c2f385e272ae25fcd0fe780edb70cf7d9 (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/qml/qqmlstringconverters.cpp')
-rw-r--r--src/qml/qml/qqmlstringconverters.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp
index ba52519eb0..bf291f0549 100644
--- a/src/qml/qml/qqmlstringconverters.cpp
+++ b/src/qml/qml/qqmlstringconverters.cpp
@@ -48,22 +48,6 @@
QT_BEGIN_NAMESPACE
-QVariant QQmlStringConverters::variantFromString(const QString &s)
-{
- if (s.isEmpty())
- return QVariant(s);
-
- bool ok = false;
- QRectF r = rectFFromString(s, &ok);
- if (ok) return QVariant(r);
- QPointF p = pointFFromString(s, &ok);
- if (ok) return QVariant(p);
- QSizeF sz = sizeFFromString(s, &ok);
- if (ok) return QVariant(sz);
-
- return QQml_valueTypeProvider()->createVariantFromString(s);
-}
-
QVariant QQmlStringConverters::variantFromString(const QString &s, int preferredType, bool *ok)
{
switch (preferredType) {