aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-06-14 08:32:13 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-06-15 13:57:32 +0200
commit0bb0eeeb09580de8bccef996f9b4099fb7d1b482 (patch)
treebaf63aed7304629f009b3928c63126cae041648d /tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
parent2cda28f3692fb1635b97a033b42ab9434437bef4 (diff)
QML: Allow creating constructible value types from variant objects
VariantObject as source for value type constructions should work the same way as other types. Pick-to: 6.5 6.6 Change-Id: I35770adf0486b404673ee00800fb1d3e429a23cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlvaluetypeproviders/testtypes.h')
-rw-r--r--tests/auto/qml/qqmlvaluetypeproviders/testtypes.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
index 28cffa3cb9..7071708244 100644
--- a/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
+++ b/tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
@@ -34,6 +34,7 @@ public:
ConstructibleValueType() = default;
Q_INVOKABLE ConstructibleValueType(int foo) : m_foo(foo) {}
Q_INVOKABLE ConstructibleValueType(QObject *) : m_foo(67) {}
+ Q_INVOKABLE ConstructibleValueType(const QUrl &) : m_foo(68) {}
int foo() const { return m_foo; }
@@ -356,6 +357,20 @@ public:
setAVariant(QVariant::fromValue(a));
}
+ Q_INVOKABLE int acceptConstructibles(const QList<ConstructibleValueType> &constructibles)
+ {
+ int result = 0;
+ for (const auto &c: constructibles) {
+ result += c.foo();
+ }
+ return result;
+ }
+
+ Q_INVOKABLE StructuredValueType acceptStructured(const StructuredValueType &a)
+ {
+ return a;
+ }
+
signals:
void changed();
void runScript();