Use qmlRegisterAnonymousType in examples and tests

Change-Id: I511d18ad8f73ea77a208e4448a8f86e5be5facc3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Ulf Hermann 2019-08-27 11:39:00 +02:00
parent 2ca41fb757
commit 76282f480e
10 changed files with 19 additions and 19 deletions

View File

@ -58,10 +58,10 @@ int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayPartyAttached>();
qmlRegisterAnonymousType<BirthdayPartyAttached>("People", 1);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<ShoeDescription>();
qmlRegisterType<Person>();
qmlRegisterAnonymousType<ShoeDescription>("People", 1);
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -58,11 +58,11 @@
int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayPartyAttached>();
qmlRegisterAnonymousType<BirthdayPartyAttached>("People", 1);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<HappyBirthdaySong>("People", 1,0, "HappyBirthdaySong");
qmlRegisterType<ShoeDescription>();
qmlRegisterType<Person>();
qmlRegisterAnonymousType<ShoeDescription>("People", 1);
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -60,7 +60,7 @@ int main(int argc, char ** argv)
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
//![0]
qmlRegisterType<Person>();
qmlRegisterAnonymousType<Person>("People", 1);
//![0]
//![register boy girl]

View File

@ -59,7 +59,7 @@ int main(int argc, char ** argv)
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<Person>();
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -59,8 +59,8 @@ int main(int argc, char ** argv)
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<ShoeDescription>();
qmlRegisterType<Person>();
qmlRegisterAnonymousType<ShoeDescription>("People", 1);
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -58,10 +58,10 @@ int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayPartyAttached>();
qmlRegisterAnonymousType<BirthdayPartyAttached>("People", 1);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<ShoeDescription>();
qmlRegisterType<Person>();
qmlRegisterAnonymousType<ShoeDescription>("People", 1);
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -59,11 +59,11 @@ int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
qmlRegisterType<BirthdayPartyAttached>();
qmlRegisterAnonymousType<BirthdayPartyAttached>("People", 1);
qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty");
qmlRegisterType<HappyBirthdaySong>("People", 1,0, "HappyBirthdaySong");
qmlRegisterType<ShoeDescription>();
qmlRegisterType<Person>();
qmlRegisterAnonymousType<ShoeDescription>("People", 1);
qmlRegisterAnonymousType<Person>("People", 1);
qmlRegisterType<Boy>("People", 1,0, "Boy");
qmlRegisterType<Girl>("People", 1,0, "Girl");

View File

@ -57,7 +57,7 @@ void registerTypes()
qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType");
qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, "Test", 1, 0, "MyNamespace", "Access to enums & flags only");
qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus");
qmlRegisterType<MyGroupedObject>();
qmlRegisterAnonymousType<MyGroupedObject>("Test", 1);
qmlRegisterType<MyRevisionedClass>("Test",1,0,"MyRevisionedClass");
qmlRegisterType<MyRevisionedClass,1>("Test",1,1,"MyRevisionedClass");
qmlRegisterType<MyRevisionedIllegalOverload>("Test",1,0,"MyRevisionedIllegalOverload");

View File

@ -87,7 +87,7 @@ public:
void tst_qqmllistreference::initTestCase()
{
QQmlDataTest::initTestCase();
qmlRegisterType<TestType>();
qmlRegisterAnonymousType<TestType>("Test", 1);
}
void tst_qqmllistreference::qmllistreference()

View File

@ -389,7 +389,7 @@ void tst_QQuickListView::init()
m_view = nullptr;
}
#endif
qmlRegisterType<QAbstractItemModel>();
qmlRegisterAnonymousType<QAbstractItemModel>("Proxy", 1);
qmlRegisterType<ProxyTestInnerModel>("Proxy", 1, 0, "ProxyTestInnerModel");
qmlRegisterType<QSortFilterProxyModel>("Proxy", 1, 0, "QSortFilterProxyModel");
}