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