1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28#include "testtypes.h"
29#ifndef QT_NO_WIDGETS
30# include <QWidget>
31# include <QPlainTextEdit>
32#endif
33#include <QQmlEngine>
34#include <QJSEngine>
35#include <QThread>
36
37class BaseExtensionObject : public QObject
38{
39 Q_OBJECT
40 Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged)
41public:
42 BaseExtensionObject(QObject *parent) : QObject(parent), m_value(0) {}
43
44 int extendedProperty() const { return m_value; }
45 void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); }
46
47signals:
48 void extendedPropertyChanged();
49private:
50 int m_value;
51};
52
53class AbstractExtensionObject : public QObject
54{
55 Q_OBJECT
56 Q_PROPERTY(int abstractProperty READ abstractProperty WRITE setAbstractProperty NOTIFY abstractPropertyChanged)
57public:
58
59 AbstractExtensionObject(QObject *parent = nullptr) : QObject(parent), m_abstractProperty(-1) {}
60
61 void setAbstractProperty(int abstractProperty) { m_abstractProperty = abstractProperty; emit abstractPropertyChanged(); }
62 int abstractProperty() const { return m_abstractProperty; }
63
64 virtual void shouldBeImplemented() = 0;
65
66signals:
67 void abstractPropertyChanged();
68
69private:
70 int m_abstractProperty;
71};
72
73class ImplementedExtensionObject : public AbstractExtensionObject
74{
75 Q_OBJECT
76 Q_PROPERTY(int implementedProperty READ implementedProperty WRITE setImplementedProperty NOTIFY implementedPropertyChanged)
77public:
78 ImplementedExtensionObject(QObject *parent = nullptr) : AbstractExtensionObject(parent), m_implementedProperty(883) {}
79 void shouldBeImplemented() {}
80
81 void setImplementedProperty(int implementedProperty) { m_implementedProperty = implementedProperty; emit implementedPropertyChanged(); }
82 int implementedProperty() const { return m_implementedProperty; }
83
84signals:
85 void implementedPropertyChanged();
86
87private:
88 int m_implementedProperty;
89};
90
91class ExtensionObject : public QObject
92{
93 Q_OBJECT
94 Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged)
95public:
96 ExtensionObject(QObject *parent) : QObject(parent), m_value(0) {}
97
98 int extendedProperty() const { return m_value; }
99 void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); }
100
101signals:
102 void extendedPropertyChanged();
103private:
104 int m_value;
105};
106
107class DefaultPropertyExtensionObject : public QObject
108{
109 Q_OBJECT
110 Q_CLASSINFO("DefaultProperty", "firstProperty")
111public:
112 DefaultPropertyExtensionObject(QObject *parent) : QObject(parent) {}
113};
114
115class QWidgetDeclarativeUI : public QObject
116{
117 Q_OBJECT
118
119 Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
120
121signals:
122 void widthChanged();
123
124public:
125 QWidgetDeclarativeUI(QObject *other) : QObject(other) { }
126
127public:
128 int width() const { return 0; }
129 void setWidth(int) { }
130};
131
132void MyQmlObject::v8function(QQmlV4Function *function)
133{
134 function->v4engine()->throwError(QStringLiteral("Exception thrown from within QObject slot"));
135}
136
137static QJSValue script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
138{
139 Q_UNUSED(engine)
140
141 static int testProperty = 13;
142 QJSValue v = scriptEngine->newObject();
143 v.setProperty(name: "scriptTestProperty", value: testProperty++);
144 return v;
145}
146
147static QJSValue readonly_script_api(QQmlEngine *engine, QJSEngine *scriptEngine)
148{
149 Q_UNUSED(engine)
150
151 static int testProperty = 42;
152 QJSValue v = scriptEngine->newObject();
153 v.setProperty(name: "scriptTestProperty", value: testProperty++);
154
155 // now freeze it so that it's read-only
156 QJSValue freezeFunction = scriptEngine->evaluate(program: "(function(obj) { return Object.freeze(obj); })");
157 v = freezeFunction.call(args: QJSValueList() << v);
158
159 return v;
160}
161
162static QObject *testImportOrder_api(QQmlEngine *engine, QJSEngine *scriptEngine)
163{
164 Q_UNUSED(engine)
165 Q_UNUSED(scriptEngine)
166
167 testImportOrderApi *o = new testImportOrderApi(37);
168 return o;
169}
170
171static QObject *testImportOrder_api1(QQmlEngine *engine, QJSEngine *scriptEngine)
172{
173 Q_UNUSED(engine)
174 Q_UNUSED(scriptEngine)
175
176 testImportOrderApi *o = new testImportOrderApi(1);
177 return o;
178}
179
180static QObject *testImportOrder_api2(QQmlEngine *engine, QJSEngine *scriptEngine)
181{
182 Q_UNUSED(engine)
183 Q_UNUSED(scriptEngine)
184
185 testImportOrderApi *o = new testImportOrderApi(2);
186 return o;
187}
188
189static QObject *qobject_api(QQmlEngine *engine, QJSEngine *scriptEngine)
190{
191 Q_UNUSED(engine)
192 Q_UNUSED(scriptEngine)
193
194 testQObjectApi *o = new testQObjectApi();
195 o->setQObjectTestProperty(20);
196 o->setQObjectTestWritableProperty(50);
197 o->setQObjectTestWritableFinalProperty(10);
198 return o;
199}
200
201static QObject *qobject_api_two(QQmlEngine *engine, QJSEngine *scriptEngine)
202{
203 Q_UNUSED(engine)
204 Q_UNUSED(scriptEngine)
205
206 testQObjectApiTwo *o = new testQObjectApiTwo;
207 return o;
208}
209
210static QObject *qobject_api_engine_parent(QQmlEngine *engine, QJSEngine *scriptEngine)
211{
212 Q_UNUSED(scriptEngine)
213
214 static int testProperty = 26;
215 testQObjectApi *o = new testQObjectApi(engine);
216 o->setQObjectTestProperty(testProperty++);
217 return o;
218}
219
220static QObject *fallback_bindings_object(QQmlEngine *engine, QJSEngine *scriptEngine)
221{
222 Q_UNUSED(engine)
223 Q_UNUSED(scriptEngine)
224
225 return new FallbackBindingsObject();
226}
227
228static QObject *fallback_bindings_derived(QQmlEngine *engine, QJSEngine *scriptEngine)
229{
230 Q_UNUSED(engine)
231 Q_UNUSED(scriptEngine)
232
233 return new FallbackBindingsDerived();
234}
235
236class MyWorkerObjectThread : public QThread
237{
238public:
239 MyWorkerObjectThread(MyWorkerObject *o) : QThread(o), o(o) { start(); }
240
241 virtual void run() {
242 emit o->done(result: QLatin1String("good"));
243 }
244
245 MyWorkerObject *o;
246};
247
248MyWorkerObject::~MyWorkerObject()
249{
250 if (m_thread)
251 m_thread->wait();
252}
253
254void MyWorkerObject::doIt()
255{
256 Q_ASSERT(!m_thread);
257 m_thread = new MyWorkerObjectThread(this);
258}
259
260class MyDateClass : public QObject
261{
262 Q_OBJECT
263public:
264 Q_INVOKABLE QDateTime invalidDate()
265 {
266 return QDateTime();
267 }
268};
269
270class MiscTypeTestClass : public QObject
271{
272 Q_OBJECT
273public:
274 Q_INVOKABLE QUrl invalidUrl()
275 {
276 return QUrl();
277 }
278
279 Q_INVOKABLE QUrl validUrl()
280 {
281 return QUrl("http://wwww.qt-project.org");
282 }
283};
284
285class MyStringClass : public QObject
286{
287 Q_OBJECT
288public:
289 Q_INVOKABLE QStringList strings(QStringList stringList) const
290 {
291 return stringList;
292 }
293 Q_INVOKABLE QVector<QString> stringsVector(const QStringList& stringList) const
294 {
295 return stringList.toVector();
296 }
297 Q_INVOKABLE
298 std::vector<QString> stringsStdVector(const QStringList& stringList) const
299 {
300 return std::vector<QString>(stringList.begin(), stringList.end());
301 }
302 Q_INVOKABLE QList<int> integers(QList<int> v) const
303 {
304 return v;
305 }
306 Q_INVOKABLE QList<qreal> reals(QList<qreal> v) const
307 {
308 return v;
309 }
310 Q_INVOKABLE QList<bool> bools(QList<bool> v) const
311 {
312 return v;
313 }
314 Q_INVOKABLE QVector<int> integerVector(QVector<int> v) const
315 {
316 return v;
317 }
318 Q_INVOKABLE
319 std::vector<int> integerStdVector(std::vector<int> v) const
320 {
321 return v;
322 }
323 Q_INVOKABLE QVector<qreal> realVector(QVector<qreal> v) const
324 {
325 return v;
326 }
327 Q_INVOKABLE
328 std::vector<qreal> realStdVector(std::vector<qreal> v) const
329 {
330 return v;
331 }
332 Q_INVOKABLE QVector<bool> boolVector(QVector<bool> v) const
333 {
334 return v;
335 }
336 Q_INVOKABLE
337 std::vector<bool> boolStdVector(std::vector<bool> v) const
338 {
339 return v;
340 }
341};
342
343static MyInheritedQmlObject *theSingletonObject = nullptr;
344
345static QObject *inheritedQmlObject_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
346{
347 theSingletonObject = new MyInheritedQmlObject();
348 return theSingletonObject;
349}
350
351bool MyInheritedQmlObject::isItYouQObject(QObject *o)
352{
353 return o && o == theSingletonObject;
354}
355
356bool MyInheritedQmlObject::isItYouMyQmlObject(MyQmlObject *o)
357{
358 return o && o == theSingletonObject;
359}
360
361bool MyInheritedQmlObject::isItYouMyInheritedQmlObject(MyInheritedQmlObject *o)
362{
363 return o && o == theSingletonObject;
364}
365
366class TestTypeCppSingleton : public QObject
367{
368 Q_OBJECT
369 Q_PROPERTY(int foo READ foo)
370
371 Q_CLASSINFO("DefaultProperty", "foo")
372public:
373 int foo() { return 0; }
374 static TestTypeCppSingleton *instance() {
375 static TestTypeCppSingleton cppSingleton;
376 return &cppSingleton;
377 }
378private:
379 TestTypeCppSingleton(){}
380 ~TestTypeCppSingleton() {
381 // just to make sure it crashes on double delete
382 static int a = 0;
383 static int *ptr = &a;
384 *ptr = 1;
385 ptr = nullptr;
386 }
387};
388
389QObject *testTypeCppProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
390{
391 Q_UNUSED(engine);
392 Q_UNUSED(scriptEngine);
393 TestTypeCppSingleton *o = TestTypeCppSingleton::instance();
394 QQmlEngine::setObjectOwnership(o, QQmlEngine::CppOwnership);
395 return o;
396}
397
398static QObject *create_singletonWithEnum(QQmlEngine *, QJSEngine *)
399{
400 return new SingletonWithEnum;
401}
402
403QObjectContainer::QObjectContainer()
404 : widgetParent(nullptr)
405 , gcOnAppend(false)
406{}
407
408QQmlListProperty<QObject> QObjectContainer::data()
409{
410 return QQmlListProperty<QObject>(this, nullptr, children_append, children_count, children_at, children_clear);
411}
412
413void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject *o)
414{
415 QObjectContainer *that = static_cast<QObjectContainer*>(prop->object);
416 that->dataChildren.append(t: o);
417 QObject::connect(sender: o, SIGNAL(destroyed(QObject*)), receiver: prop->object, SLOT(childDestroyed(QObject*)));
418
419 if (that->gcOnAppend) {
420 QQmlEngine *engine = qmlEngine(that);
421 engine->collectGarbage();
422 QCoreApplication::sendPostedEvents(receiver: nullptr, event_type: QEvent::DeferredDelete);
423 QCoreApplication::processEvents();
424 }
425}
426
427int QObjectContainer::children_count(QQmlListProperty<QObject> *prop)
428{
429 return static_cast<QObjectContainer*>(prop->object)->dataChildren.count();
430}
431
432QObject *QObjectContainer::children_at(QQmlListProperty<QObject> *prop, int index)
433{
434 return static_cast<QObjectContainer*>(prop->object)->dataChildren.at(i: index);
435}
436
437void QObjectContainer::children_clear(QQmlListProperty<QObject> *prop)
438{
439 QObjectContainer *that = static_cast<QObjectContainer*>(prop->object);
440 foreach (QObject *c, that->dataChildren)
441 QObject::disconnect(sender: c, SIGNAL(destroyed(QObject*)), receiver: that, SLOT(childDestroyed(QObject*)));
442 that->dataChildren.clear();
443}
444
445void QObjectContainer::childDestroyed(QObject *child) {
446 dataChildren.removeAll(t: child);
447}
448
449void FloatingQObject::classBegin()
450{
451 setParent(nullptr);
452}
453
454void FloatingQObject::componentComplete()
455{
456 Q_ASSERT(!parent());
457}
458
459void registerTypes()
460{
461 qmlRegisterType<MyQmlObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyQmlObjectAlias");
462 qmlRegisterType<MyQmlObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyQmlObject");
463 qmlRegisterSingletonType<MyInheritedQmlObject>(uri: "Test", versionMajor: 1, versionMinor: 0, typeName: "MyInheritedQmlObjectSingleton", callback: inheritedQmlObject_provider);
464 qmlRegisterSingletonType<TestTypeCppSingleton>(uri: "Test", versionMajor: 1, versionMinor: 0, typeName: "TestTypeCppSingleton", callback: testTypeCppProvider);
465 qmlRegisterType<MyDeferredObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyDeferredObject");
466 qmlRegisterType<MyVeryDeferredObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyVeryDeferredObject");
467 qmlRegisterType<MyQmlContainer>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyQmlContainer");
468 qmlRegisterExtendedType<MyBaseExtendedObject, BaseExtensionObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyBaseExtendedObject");
469 qmlRegisterExtendedType<MyExtendedObject, ExtensionObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyExtendedObject");
470 qmlRegisterType<MyTypeObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyTypeObject");
471 qmlRegisterType<MyDerivedObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyDerivedObject");
472 qmlRegisterType<NumberAssignment>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "NumberAssignment");
473 qmlRegisterExtendedType<DefaultPropertyExtendedObject, DefaultPropertyExtensionObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "DefaultPropertyExtendedObject");
474 qmlRegisterType<OverrideDefaultPropertyObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "OverrideDefaultPropertyObject");
475 qmlRegisterType<MyRevisionedClass>(uri: "Qt.test",versionMajor: 1,versionMinor: 0,qmlName: "MyRevisionedClass");
476 qmlRegisterType<MyDeleteObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyDeleteObject");
477 qmlRegisterType<MyRevisionedClass,1>(uri: "Qt.test",versionMajor: 1,versionMinor: 1,qmlName: "MyRevisionedClass");
478 qmlRegisterType<MyWorkerObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyWorkerObject");
479
480 qmlRegisterExtendedUncreatableType<AbstractExtensionObject, ExtensionObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "AbstractExtensionObject", QStringLiteral("Abstracts are uncreatable"));
481 qmlRegisterType<ImplementedExtensionObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "ImplementedExtensionObject");
482
483 // test scarce resource property binding post-evaluation optimization
484 // and for testing memory usage in property var circular reference test
485 qmlRegisterType<ScarceResourceObject>(uri: "Qt.test", versionMajor: 1,versionMinor: 0, qmlName: "MyScarceResourceObject");
486
487 // Register the uncreatable base class
488 qmlRegisterRevision<MyRevisionedBaseClassRegistered,1>(uri: "Qt.test",versionMajor: 1,versionMinor: 1);
489 // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
490 qmlRegisterType<MyRevisionedSubclass>(uri: "Qt.test",versionMajor: 1,versionMinor: 0,qmlName: "MyRevisionedSubclass");
491 // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
492 qmlRegisterType<MyRevisionedSubclass,1>(uri: "Qt.test",versionMajor: 1,versionMinor: 1,qmlName: "MyRevisionedSubclass");
493 qmlRegisterType<MyItemUsingRevisionedObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MyItemUsingRevisionedObject");
494
495#ifndef QT_NO_WIDGETS
496 qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>(uri: "Qt.test",versionMajor: 1,versionMinor: 0,qmlName: "QWidget");
497 qmlRegisterType<QPlainTextEdit>(uri: "Qt.test",versionMajor: 1,versionMinor: 0,qmlName: "QPlainTextEdit");
498#endif
499
500 qRegisterMetaType<MyQmlObject::MyType>(typeName: "MyQmlObject::MyType");
501
502 qmlRegisterSingletonType(uri: "Qt.test",versionMajor: 1,versionMinor: 0,typeName: "Script",callback: script_api); // register (script) singleton Type for an existing uri which contains elements
503 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test",versionMajor: 1,versionMinor: 0,typeName: "QObject",callback: qobject_api); // register (qobject) for an existing uri for which another singleton Type was previously regd. Should replace!
504 qmlRegisterSingletonType(uri: "Qt.test.scriptApi",versionMajor: 1,versionMinor: 0,typeName: "Script",callback: script_api); // register (script) singleton Type for a uri which doesn't contain elements
505 qmlRegisterSingletonType(uri: "Qt.test.scriptApi",versionMajor: 2,versionMinor: 0,typeName: "Script",callback: readonly_script_api); // register (script) singleton Type for a uri which doesn't contain elements - will be made read-only
506 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test.qobjectApi",versionMajor: 1,versionMinor: 0,typeName: "QObject",callback: qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
507 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test.qobjectApi",versionMajor: 1,versionMinor: 3,typeName: "QObject",callback: qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
508 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test.qobjectApi",versionMajor: 2,versionMinor: 0,typeName: "QObject",callback: qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
509 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test.qobjectApiParented",versionMajor: 1,versionMinor: 0,typeName: "QObject",callback: qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
510
511 qmlRegisterSingletonType<testQObjectApi>(uri: "Qt.test.qobjectApis",versionMajor: 1,versionMinor: 0,typeName: "One",callback: qobject_api); // register multiple qobject singleton types in a single namespace
512 qmlRegisterSingletonType<testQObjectApiTwo>(uri: "Qt.test.qobjectApis",versionMajor: 1,versionMinor: 0,typeName: "Two",callback: qobject_api_two); // register multiple qobject singleton types in a single namespace
513
514 qRegisterMetaType<MyQmlObject::MyEnum2>(typeName: "MyEnum2");
515 qRegisterMetaType<Qt::MouseButtons>(typeName: "Qt::MouseButtons");
516
517 qmlRegisterType<CircularReferenceObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "CircularReferenceObject");
518
519 qmlRegisterType<MyDynamicCreationDestructionObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MyDynamicCreationDestructionObject");
520 qmlRegisterType<WriteCounter>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "WriteCounter");
521
522 qmlRegisterType<MySequenceConversionObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MySequenceConversionObject");
523
524 qmlRegisterType<MyUnregisteredEnumTypeObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MyUnregisteredEnumTypeObject");
525
526 qmlRegisterSingletonType<FallbackBindingsObject>(uri: "Qt.test.fallbackBindingsObject", versionMajor: 1, versionMinor: 0, typeName: "Fallback", callback: fallback_bindings_object);
527 qmlRegisterSingletonType<FallbackBindingsObject>(uri: "Qt.test.fallbackBindingsDerived", versionMajor: 1, versionMinor: 0, typeName: "Fallback", callback: fallback_bindings_derived);
528
529 qmlRegisterType<FallbackBindingsObject>(uri: "Qt.test.fallbackBindingsItem", versionMajor: 1, versionMinor: 0, qmlName: "FallbackBindingsType");
530 qmlRegisterType<FallbackBindingsDerived>(uri: "Qt.test.fallbackBindingsItem", versionMajor: 1, versionMinor: 0, qmlName: "FallbackBindingsDerivedType");
531
532 qmlRegisterType<FallbackBindingsTypeObject>(uri: "Qt.test.fallbackBindingsObject", versionMajor: 1, versionMinor: 0, qmlName: "FallbackBindingsType");
533 qmlRegisterType<FallbackBindingsTypeDerived>(uri: "Qt.test.fallbackBindingsDerived", versionMajor: 1, versionMinor: 0, qmlName: "FallbackBindingsType");
534
535 qmlRegisterType<MyDateClass>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MyDateClass");
536 qmlRegisterType<MyStringClass>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MyStringClass");
537 qmlRegisterType<MiscTypeTestClass>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "MiscTypeTest");
538
539 qmlRegisterSingletonType<testImportOrderApi>(uri: "Qt.test.importOrderApi",versionMajor: 1,versionMinor: 0,typeName: "Data",callback: testImportOrder_api);
540 qmlRegisterSingletonType<testImportOrderApi>(uri: "NamespaceAndType",versionMajor: 1,versionMinor: 0,typeName: "NamespaceAndType",callback: testImportOrder_api);
541 qmlRegisterSingletonType<testImportOrderApi>(uri: "Qt.test.importOrderApi1",versionMajor: 1,versionMinor: 0,typeName: "Data",callback: testImportOrder_api1);
542 qmlRegisterSingletonType<testImportOrderApi>(uri: "Qt.test.importOrderApi2",versionMajor: 1,versionMinor: 0,typeName: "Data",callback: testImportOrder_api2);
543
544 qmlRegisterSingletonType<SingletonWithEnum>(uri: "Qt.test.singletonWithEnum", versionMajor: 1, versionMinor: 0, typeName: "SingletonWithEnum", callback: create_singletonWithEnum);
545
546 qmlRegisterType<QObjectContainer>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "QObjectContainer");
547 qmlRegisterType<QObjectContainerWithGCOnAppend>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "QObjectContainerWithGCOnAppend");
548 qmlRegisterType<FloatingQObject>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "FloatingQObject");
549
550 qmlRegisterType<ClashingNames>(uri: "Qt.test", versionMajor: 1, versionMinor: 0, qmlName: "ClashingNames");
551}
552
553#include "testtypes.moc"
554

source code of qtdeclarative/tests/auto/qml/qqmlecmascript/testtypes.cpp