examples/declarative/cppextensions/referenceexamples/extended/main.cpp
changeset 37 758a864f9613
parent 30 5dc02b23752f
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    49     QApplication app(argc, argv);
    49     QApplication app(argc, argv);
    50 
    50 
    51     qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
    51     qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
    52 
    52 
    53     QDeclarativeEngine engine;
    53     QDeclarativeEngine engine;
    54     QDeclarativeComponent component(&engine, ":example.qml");
    54     QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
    55     QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
    55     QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
    56 
    56 
    57     if (edit) {
    57     if (edit) {
    58         edit->show();
    58         edit->show();
    59         return app.exec();
    59         return app.exec();
    60     } else {
    60     } else {
    61         qWarning() << "An error occured";
    61         qWarning() << component.errors();
    62         return 0;
    62         return 0;
    63     }
    63     }
    64 }
    64 }