examples/declarative/cppextensions/referenceexamples/signal/main.cpp
changeset 37 758a864f9613
parent 30 5dc02b23752f
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    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 
    82                 qWarning() << "   " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
    82                 qWarning() << "   " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
    83         }
    83         }
    84 
    84 
    85         party->startParty();
    85         party->startParty();
    86     } else {
    86     } else {
    87         qWarning() << "An error occured";
    87         qWarning() << component.errors();
    88     }
    88     }
    89 
    89 
    90     return 0;
    90     return 0;
    91 }
    91 }