equal
deleted
inserted
replaced
56 qmlRegisterType<Person>(); |
56 qmlRegisterType<Person>(); |
57 qmlRegisterType<Boy>("People", 1,0, "Boy"); |
57 qmlRegisterType<Boy>("People", 1,0, "Boy"); |
58 qmlRegisterType<Girl>("People", 1,0, "Girl"); |
58 qmlRegisterType<Girl>("People", 1,0, "Girl"); |
59 |
59 |
60 QDeclarativeEngine engine; |
60 QDeclarativeEngine engine; |
61 QDeclarativeComponent component(&engine, ":example.qml"); |
61 QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); |
62 BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); |
62 BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); |
63 |
63 |
64 if (party && party->host()) { |
64 if (party && party->host()) { |
65 qWarning() << party->host()->name() << "is having a birthday!"; |
65 qWarning() << party->host()->name() << "is having a birthday!"; |
66 |
66 |
84 qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString()); |
84 qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString()); |
85 } |
85 } |
86 |
86 |
87 party->startParty(); |
87 party->startParty(); |
88 } else { |
88 } else { |
89 qWarning() << "An error occured"; |
89 qWarning() << component.errors(); |
90 } |
90 } |
91 |
91 |
92 return app.exec(); |
92 return app.exec(); |
93 } |
93 } |