examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp
changeset 37 758a864f9613
parent 30 5dc02b23752f
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    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 }