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