equal
deleted
inserted
replaced
52 qmlRegisterType<Person>(); |
52 qmlRegisterType<Person>(); |
53 qmlRegisterType<Boy>("People", 1,0, "Boy"); |
53 qmlRegisterType<Boy>("People", 1,0, "Boy"); |
54 qmlRegisterType<Girl>("People", 1,0, "Girl"); |
54 qmlRegisterType<Girl>("People", 1,0, "Girl"); |
55 |
55 |
56 QDeclarativeEngine engine; |
56 QDeclarativeEngine engine; |
57 QDeclarativeComponent component(&engine, ":example.qml"); |
57 QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); |
58 BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); |
58 BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); |
59 |
59 |
60 if (party && party->host()) { |
60 if (party && party->host()) { |
61 qWarning() << party->host()->name() << "is having a birthday!"; |
61 qWarning() << party->host()->name() << "is having a birthday!"; |
62 |
62 |
66 qWarning() << "She is inviting:"; |
66 qWarning() << "She is inviting:"; |
67 |
67 |
68 for (int ii = 0; ii < party->guestCount(); ++ii) |
68 for (int ii = 0; ii < party->guestCount(); ++ii) |
69 qWarning() << " " << party->guest(ii)->name(); |
69 qWarning() << " " << party->guest(ii)->name(); |
70 } else { |
70 } else { |
71 qWarning() << "An error occured"; |
71 qWarning() << component.errors(); |
72 } |
72 } |
73 |
73 |
74 return 0; |
74 return 0; |
75 } |
75 } |