examples/declarative/cppextensions/referenceexamples/grouped/main.cpp
changeset 37 758a864f9613
parent 30 5dc02b23752f
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    53     qmlRegisterType<Person>();
    53     qmlRegisterType<Person>();
    54     qmlRegisterType<Boy>("People", 1,0, "Boy");
    54     qmlRegisterType<Boy>("People", 1,0, "Boy");
    55     qmlRegisterType<Girl>("People", 1,0, "Girl");
    55     qmlRegisterType<Girl>("People", 1,0, "Girl");
    56 
    56 
    57     QDeclarativeEngine engine;
    57     QDeclarativeEngine engine;
    58     QDeclarativeComponent component(&engine, ":example.qml");
    58     QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
    59     BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
    59     BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
    60 
    60 
    61     if (party && party->host()) {
    61     if (party && party->host()) {
    62         qWarning() << party->host()->name() << "is having a birthday!";
    62         qWarning() << party->host()->name() << "is having a birthday!";
    63 
    63 
    76         }
    76         }
    77         if (bestShoe)
    77         if (bestShoe)
    78             qWarning() << bestShoe->name() << "is wearing the best shoes!";
    78             qWarning() << bestShoe->name() << "is wearing the best shoes!";
    79 
    79 
    80     } else {
    80     } else {
    81         qWarning() << "An error occured";
    81         qWarning() << component.errors();
    82     }
    82     }
    83 
    83 
    84     return 0;
    84     return 0;
    85 }
    85 }