aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/testtypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/testtypes.h')
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h56
1 files changed, 45 insertions, 11 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index bc4d97237c..64c079a937 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -31,6 +31,7 @@
#include <private/qqmlengine_p.h>
#include <private/qv4qobjectwrapper_p.h>
+#include <private/qqmlcomponentattached_p.h>
class MyQmlAttachedObject : public QObject
{
@@ -862,6 +863,17 @@ struct NonRegisteredType
struct CompletelyUnknown;
+class SingletonWithEnum : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(TestEnum)
+public:
+ enum TestEnum {
+ TestValue = 42,
+ TestValue_MinusOne = -1
+ };
+};
+
class MyInvokableObject : public MyInvokableBaseObject
{
Q_OBJECT
@@ -955,12 +967,43 @@ public:
invoke(40);
m_actuals << f;
}
+
Q_INVOKABLE void method_qobject(QObject *o)
{
invoke(41);
m_actuals << QVariant::fromValue(o);
}
+ Q_INVOKABLE QQmlComponent *someComponent() { return &m_someComponent; }
+ Q_INVOKABLE void method_component(QQmlComponent *c)
+ {
+ invoke(42);
+ m_actuals << QVariant::fromValue(c);
+ }
+
+ Q_INVOKABLE MyTypeObject *someTypeObject() { return &m_someTypeObject; }
+ Q_INVOKABLE void method_component(MyTypeObject *c)
+ {
+ invoke(43);
+ m_actuals << QVariant::fromValue(c);
+ }
+
+ Q_INVOKABLE void method_component(const QUrl &c)
+ {
+ invoke(44);
+ m_actuals << QVariant::fromValue(c);
+ }
+
+ Q_INVOKABLE void method_typeWrapper(QQmlComponentAttached *attached)
+ {
+ m_actuals << QVariant::fromValue(attached);
+ }
+
+ Q_INVOKABLE void method_typeWrapper(SingletonWithEnum *singleton)
+ {
+ m_actuals << QVariant::fromValue(singleton);
+ }
+
private:
friend class MyInvokableBaseObject;
void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;}
@@ -969,6 +1012,8 @@ private:
QVariantList m_actuals;
QFont m_someFont;
+ QQmlComponent m_someComponent;
+ MyTypeObject m_someTypeObject;
public:
Q_SIGNALS:
@@ -1807,17 +1852,6 @@ public:
QML_DECLARE_TYPEINFO(FallbackBindingsTypeObject, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPEINFO(FallbackBindingsTypeDerived, QML_HAS_ATTACHED_PROPERTIES)
-class SingletonWithEnum : public QObject
-{
- Q_OBJECT
- Q_ENUMS(TestEnum)
-public:
- enum TestEnum {
- TestValue = 42,
- TestValue_MinusOne = -1
- };
-};
-
// Like QtObject, but with default property
class QObjectContainer : public QObject
{