diff options
Diffstat (limited to 'examples')
30 files changed, 58 insertions, 47 deletions
diff --git a/examples/declarative/extending/adding/main.cpp b/examples/declarative/extending/adding/main.cpp index 74ea35c..0aeeecf 100644 --- a/examples/declarative/extending/adding/main.cpp +++ b/examples/declarative/extending/adding/main.cpp @@ -48,6 +48,8 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_TYPE(People, 1,0, Person, Person); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); Person *person = qobject_cast<Person *>(component.create()); diff --git a/examples/declarative/extending/adding/person.cpp b/examples/declarative/extending/adding/person.cpp index 9efa2b8..cdf08e0 100644 --- a/examples/declarative/extending/adding/person.cpp +++ b/examples/declarative/extending/adding/person.cpp @@ -66,5 +66,4 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -QML_DEFINE_TYPE(People, 1,0, Person, Person); // ![0] diff --git a/examples/declarative/extending/attached/birthdayparty.cpp b/examples/declarative/extending/attached/birthdayparty.cpp index ffdda57..293628e 100644 --- a/examples/declarative/extending/attached/birthdayparty.cpp +++ b/examples/declarative/extending/attached/birthdayparty.cpp @@ -55,8 +55,6 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) m_rsvp = d; } -QML_DEFINE_NOCREATE_TYPE(BirthdayPartyAttached); - BirthdayParty::BirthdayParty(QObject *parent) : QObject(parent), m_celebrant(0) { @@ -92,4 +90,3 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/attached/main.cpp b/examples/declarative/extending/attached/main.cpp index 27a9287..f4223a2 100644 --- a/examples/declarative/extending/attached/main.cpp +++ b/examples/declarative/extending/attached/main.cpp @@ -49,6 +49,13 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_NOCREATE_TYPE(BirthdayPartyAttached); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_NOCREATE_TYPE(ShoeDescription); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/attached/person.cpp b/examples/declarative/extending/attached/person.cpp index 909505a..0a9e508 100644 --- a/examples/declarative/extending/attached/person.cpp +++ b/examples/declarative/extending/attached/person.cpp @@ -84,7 +84,6 @@ void ShoeDescription::setPrice(qreal p) { m_price = p; } -QML_DEFINE_NOCREATE_TYPE(ShoeDescription); Person::Person(QObject *parent) : QObject(parent) @@ -106,18 +105,15 @@ ShoeDescription *Person::shoe() return &m_shoe; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); diff --git a/examples/declarative/extending/binding/birthdayparty.cpp b/examples/declarative/extending/binding/birthdayparty.cpp index 62b9c7b..392c59a 100644 --- a/examples/declarative/extending/binding/birthdayparty.cpp +++ b/examples/declarative/extending/binding/birthdayparty.cpp @@ -58,7 +58,6 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) } } -QML_DEFINE_NOCREATE_TYPE(BirthdayPartyAttached); BirthdayParty::BirthdayParty(QObject *parent) : QObject(parent), m_celebrant(0) @@ -113,4 +112,3 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/binding/happybirthday.cpp b/examples/declarative/extending/binding/happybirthday.cpp index 38f3c08..704d384 100644 --- a/examples/declarative/extending/binding/happybirthday.cpp +++ b/examples/declarative/extending/binding/happybirthday.cpp @@ -84,4 +84,3 @@ void HappyBirthday::advance() m_target.write(m_lyrics.at(m_line)); } -QML_DEFINE_TYPE(People, 1,0, HappyBirthday, HappyBirthday); diff --git a/examples/declarative/extending/binding/main.cpp b/examples/declarative/extending/binding/main.cpp index ba38e82..ea0e33a 100644 --- a/examples/declarative/extending/binding/main.cpp +++ b/examples/declarative/extending/binding/main.cpp @@ -43,12 +43,21 @@ #include <QmlComponent> #include <QDebug> #include "birthdayparty.h" +#include "happybirthday.h" #include "person.h" int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_NOCREATE_TYPE(BirthdayPartyAttached); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_TYPE(People, 1,0, HappyBirthday, HappyBirthday); + QML_REGISTER_NOCREATE_TYPE(ShoeDescription); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/binding/person.cpp b/examples/declarative/extending/binding/person.cpp index 50fb754..9a2248f 100644 --- a/examples/declarative/extending/binding/person.cpp +++ b/examples/declarative/extending/binding/person.cpp @@ -100,7 +100,6 @@ void ShoeDescription::setPrice(qreal p) m_price = p; emit shoeChanged(); } -QML_DEFINE_NOCREATE_TYPE(ShoeDescription); Person::Person(QObject *parent) : QObject(parent) @@ -126,18 +125,15 @@ ShoeDescription *Person::shoe() return &m_shoe; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); diff --git a/examples/declarative/extending/coercion/birthdayparty.cpp b/examples/declarative/extending/coercion/birthdayparty.cpp index 15a4ca9..f0eb599 100644 --- a/examples/declarative/extending/coercion/birthdayparty.cpp +++ b/examples/declarative/extending/coercion/birthdayparty.cpp @@ -70,4 +70,3 @@ Person *BirthdayParty::guest(int index) const return m_guests.at(index); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/coercion/main.cpp b/examples/declarative/extending/coercion/main.cpp index ccbee83..b1a203f 100644 --- a/examples/declarative/extending/coercion/main.cpp +++ b/examples/declarative/extending/coercion/main.cpp @@ -49,6 +49,13 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); +// ![0] + QML_REGISTER_NOCREATE_TYPE(Person); +// ![0] + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/coercion/person.cpp b/examples/declarative/extending/coercion/person.cpp index 9eef8f7..5b5203a 100644 --- a/examples/declarative/extending/coercion/person.cpp +++ b/examples/declarative/extending/coercion/person.cpp @@ -65,22 +65,16 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -// ![0] -QML_DEFINE_NOCREATE_TYPE(Person); -// ![0] - // ![1] Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); // ![1] diff --git a/examples/declarative/extending/default/birthdayparty.cpp b/examples/declarative/extending/default/birthdayparty.cpp index 15a4ca9..f0eb599 100644 --- a/examples/declarative/extending/default/birthdayparty.cpp +++ b/examples/declarative/extending/default/birthdayparty.cpp @@ -70,4 +70,3 @@ Person *BirthdayParty::guest(int index) const return m_guests.at(index); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/default/main.cpp b/examples/declarative/extending/default/main.cpp index ccbee83..ea51e00 100644 --- a/examples/declarative/extending/default/main.cpp +++ b/examples/declarative/extending/default/main.cpp @@ -49,6 +49,11 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/default/person.cpp b/examples/declarative/extending/default/person.cpp index a0b4960..69216d3 100644 --- a/examples/declarative/extending/default/person.cpp +++ b/examples/declarative/extending/default/person.cpp @@ -65,18 +65,15 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); diff --git a/examples/declarative/extending/extended/lineedit.cpp b/examples/declarative/extending/extended/lineedit.cpp index ec86aad..0d8eb7f 100644 --- a/examples/declarative/extending/extended/lineedit.cpp +++ b/examples/declarative/extending/extended/lineedit.cpp @@ -103,4 +103,3 @@ void LineEditExtension::setBottomMargin(int m) } QML_DECLARE_TYPE(QLineEdit); -QML_DEFINE_EXTENDED_TYPE(People, 1,0, QLineEdit, QLineEdit, LineEditExtension); diff --git a/examples/declarative/extending/extended/main.cpp b/examples/declarative/extending/extended/main.cpp index 9376af7..ad4bf50 100644 --- a/examples/declarative/extending/extended/main.cpp +++ b/examples/declarative/extending/extended/main.cpp @@ -43,11 +43,14 @@ #include <QmlComponent> #include <QDebug> #include <QLineEdit> +#include "lineedit.h" int main(int argc, char ** argv) { QApplication app(argc, argv); + QML_REGISTER_EXTENDED_TYPE(People, 1,0, QLineEdit, QLineEdit, LineEditExtension); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); QLineEdit *edit = qobject_cast<QLineEdit *>(component.create()); diff --git a/examples/declarative/extending/grouped/birthdayparty.cpp b/examples/declarative/extending/grouped/birthdayparty.cpp index 15a4ca9..f0eb599 100644 --- a/examples/declarative/extending/grouped/birthdayparty.cpp +++ b/examples/declarative/extending/grouped/birthdayparty.cpp @@ -70,4 +70,3 @@ Person *BirthdayParty::guest(int index) const return m_guests.at(index); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/grouped/main.cpp b/examples/declarative/extending/grouped/main.cpp index 79aaab5..a8dafd9 100644 --- a/examples/declarative/extending/grouped/main.cpp +++ b/examples/declarative/extending/grouped/main.cpp @@ -49,6 +49,12 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_NOCREATE_TYPE(ShoeDescription); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/grouped/person.cpp b/examples/declarative/extending/grouped/person.cpp index 909505a..0a9e508 100644 --- a/examples/declarative/extending/grouped/person.cpp +++ b/examples/declarative/extending/grouped/person.cpp @@ -84,7 +84,6 @@ void ShoeDescription::setPrice(qreal p) { m_price = p; } -QML_DEFINE_NOCREATE_TYPE(ShoeDescription); Person::Person(QObject *parent) : QObject(parent) @@ -106,18 +105,15 @@ ShoeDescription *Person::shoe() return &m_shoe; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); diff --git a/examples/declarative/extending/properties/birthdayparty.cpp b/examples/declarative/extending/properties/birthdayparty.cpp index 23e6e58..2fbdad9 100644 --- a/examples/declarative/extending/properties/birthdayparty.cpp +++ b/examples/declarative/extending/properties/birthdayparty.cpp @@ -72,4 +72,3 @@ Person *BirthdayParty::guest(int index) const } // ![0] -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/properties/main.cpp b/examples/declarative/extending/properties/main.cpp index 97d7905..2211b89 100644 --- a/examples/declarative/extending/properties/main.cpp +++ b/examples/declarative/extending/properties/main.cpp @@ -49,6 +49,9 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_TYPE(People, 1,0, Person, Person); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/properties/person.cpp b/examples/declarative/extending/properties/person.cpp index d1b8bf4..92c54f5 100644 --- a/examples/declarative/extending/properties/person.cpp +++ b/examples/declarative/extending/properties/person.cpp @@ -65,4 +65,3 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -QML_DEFINE_TYPE(People, 1,0, Person, Person); diff --git a/examples/declarative/extending/signal/birthdayparty.cpp b/examples/declarative/extending/signal/birthdayparty.cpp index d8686f0..d57e075 100644 --- a/examples/declarative/extending/signal/birthdayparty.cpp +++ b/examples/declarative/extending/signal/birthdayparty.cpp @@ -55,7 +55,6 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) m_rsvp = d; } -QML_DEFINE_NOCREATE_TYPE(BirthdayPartyAttached); BirthdayParty::BirthdayParty(QObject *parent) : QObject(parent), m_celebrant(0) @@ -98,4 +97,3 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/signal/main.cpp b/examples/declarative/extending/signal/main.cpp index eb3bb4b..9d8e253 100644 --- a/examples/declarative/extending/signal/main.cpp +++ b/examples/declarative/extending/signal/main.cpp @@ -49,6 +49,13 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_NOCREATE_TYPE(BirthdayPartyAttached); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_NOCREATE_TYPE(ShoeDescription); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/signal/person.cpp b/examples/declarative/extending/signal/person.cpp index 909505a..0a9e508 100644 --- a/examples/declarative/extending/signal/person.cpp +++ b/examples/declarative/extending/signal/person.cpp @@ -84,7 +84,6 @@ void ShoeDescription::setPrice(qreal p) { m_price = p; } -QML_DEFINE_NOCREATE_TYPE(ShoeDescription); Person::Person(QObject *parent) : QObject(parent) @@ -106,18 +105,15 @@ ShoeDescription *Person::shoe() return &m_shoe; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); diff --git a/examples/declarative/extending/valuesource/birthdayparty.cpp b/examples/declarative/extending/valuesource/birthdayparty.cpp index a5b3fab..5b3fec1 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.cpp +++ b/examples/declarative/extending/valuesource/birthdayparty.cpp @@ -55,7 +55,6 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) m_rsvp = d; } -QML_DEFINE_NOCREATE_TYPE(BirthdayPartyAttached); BirthdayParty::BirthdayParty(QObject *parent) : QObject(parent), m_celebrant(0) @@ -108,4 +107,3 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(People, 1,0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/valuesource/happybirthday.cpp b/examples/declarative/extending/valuesource/happybirthday.cpp index fbbc9e9..306ec98 100644 --- a/examples/declarative/extending/valuesource/happybirthday.cpp +++ b/examples/declarative/extending/valuesource/happybirthday.cpp @@ -79,4 +79,3 @@ void HappyBirthday::advance() m_target.write(m_lyrics.at(m_line)); } -QML_DEFINE_TYPE(People, 1,0, HappyBirthday, HappyBirthday); diff --git a/examples/declarative/extending/valuesource/main.cpp b/examples/declarative/extending/valuesource/main.cpp index ba38e82..ea0e33a 100644 --- a/examples/declarative/extending/valuesource/main.cpp +++ b/examples/declarative/extending/valuesource/main.cpp @@ -43,12 +43,21 @@ #include <QmlComponent> #include <QDebug> #include "birthdayparty.h" +#include "happybirthday.h" #include "person.h" int main(int argc, char ** argv) { QCoreApplication app(argc, argv); + QML_REGISTER_NOCREATE_TYPE(BirthdayPartyAttached); + QML_REGISTER_TYPE(People, 1,0, BirthdayParty, BirthdayParty); + QML_REGISTER_TYPE(People, 1,0, HappyBirthday, HappyBirthday); + QML_REGISTER_NOCREATE_TYPE(ShoeDescription); + QML_REGISTER_NOCREATE_TYPE(Person); + QML_REGISTER_TYPE(People, 1,0, Boy, Boy); + QML_REGISTER_TYPE(People, 1,0, Girl, Girl); + QmlEngine engine; QmlComponent component(&engine, ":example.qml"); BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/declarative/extending/valuesource/person.cpp b/examples/declarative/extending/valuesource/person.cpp index 909505a..0a9e508 100644 --- a/examples/declarative/extending/valuesource/person.cpp +++ b/examples/declarative/extending/valuesource/person.cpp @@ -84,7 +84,6 @@ void ShoeDescription::setPrice(qreal p) { m_price = p; } -QML_DEFINE_NOCREATE_TYPE(ShoeDescription); Person::Person(QObject *parent) : QObject(parent) @@ -106,18 +105,15 @@ ShoeDescription *Person::shoe() return &m_shoe; } -QML_DEFINE_NOCREATE_TYPE(Person); Boy::Boy(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(People, 1,0, Girl, Girl); |