diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-11 05:06:56 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-11 05:06:56 (GMT) |
commit | 0c1d29300c7248ead3392bb385ceae6889dc2834 (patch) | |
tree | abb4e514e932c280de7292179288a779211f9d8a /examples/declarative/cppextensions | |
parent | b63d7dc74b30b741c6481fb41d8bb3951a9bd763 (diff) | |
download | Qt-0c1d29300c7248ead3392bb385ceae6889dc2834.zip Qt-0c1d29300c7248ead3392bb385ceae6889dc2834.tar.gz Qt-0c1d29300c7248ead3392bb385ceae6889dc2834.tar.bz2 |
Fix cppextension examples.
Print a useful message on error.
Specify the QML url correctly.
Diffstat (limited to 'examples/declarative/cppextensions')
10 files changed, 20 insertions, 20 deletions
diff --git a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp index 391113c..19cf034 100644 --- a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp @@ -51,13 +51,13 @@ int main(int argc, char ** argv) //![0] QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); Person *person = qobject_cast<Person *>(component.create()); if (person) { qWarning() << "The person's name is" << person->name(); qWarning() << "They wear a" << person->shoeSize() << "sized shoe"; } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp index 5a39a98..65cbc93 100644 --- a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -83,7 +83,7 @@ int main(int argc, char ** argv) } } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp index fe1bbc8..150f961 100644 --- a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp @@ -57,7 +57,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -85,7 +85,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return app.exec(); diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp index 5c53368..5b16f99 100644 --- a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -70,7 +70,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/default/main.cpp b/examples/declarative/cppextensions/referenceexamples/default/main.cpp index f611bc4..bfba642 100644 --- a/examples/declarative/cppextensions/referenceexamples/default/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/default/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -68,7 +68,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp index 65527c3..08c8440 100644 --- a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp @@ -51,14 +51,14 @@ int main(int argc, char ** argv) qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); QLineEdit *edit = qobject_cast<QLineEdit *>(component.create()); if (edit) { edit->show(); return app.exec(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); return 0; } } diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp index e56a14d..6f7f13f 100644 --- a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -78,7 +78,7 @@ int main(int argc, char ** argv) qWarning() << bestShoe->name() << "is wearing the best shoes!"; } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp index 80237ef..d974647 100644 --- a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char ** argv) qmlRegisterType<Person>("People", 1,0, "Person"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -61,7 +61,7 @@ int main(int argc, char ** argv) for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp index 56c0809..ad87bee 100644 --- a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -84,7 +84,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return 0; diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp index 40dc3cb..aa77665 100644 --- a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp +++ b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char ** argv) qmlRegisterType<Girl>("People", 1,0, "Girl"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, ":example.qml"); + QDeclarativeComponent component(&engine, QUrl("qrc:example.qml")); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); if (party && party->host()) { @@ -86,7 +86,7 @@ int main(int argc, char ** argv) party->startParty(); } else { - qWarning() << "An error occurred"; + qWarning() << component.errors(); } return app.exec(); |