diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 18:46:38 +0200 | 
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-14 19:02:37 +0200 | 
| commit | c2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e (patch) | |
| tree | c6f7e058a985d7c18b51cadc76283caf555071c9 /examples/qml/referenceexamples/valuesource | |
| parent | 9e633bbda7608ac0231809e2a6a97ae8f2d849d6 (diff) | |
| parent | 803f18f02e5609a1ca00a5b78ea6d3613d44e1a0 (diff) | |
| download | qtdeclarative-c2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e.tar.gz | |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml because we don't use it yet in wip/cmake.
Fixed conflict in qmlcachegen.cpp.
Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
Diffstat (limited to 'examples/qml/referenceexamples/valuesource')
| -rw-r--r-- | examples/qml/referenceexamples/valuesource/birthdayparty.h | 4 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/valuesource/main.cpp | 15 | ||||
| -rw-r--r-- | examples/qml/referenceexamples/valuesource/person.h | 5 | 
3 files changed, 13 insertions, 11 deletions
diff --git a/examples/qml/referenceexamples/valuesource/birthdayparty.h b/examples/qml/referenceexamples/valuesource/birthdayparty.h index 18a9b96147..25e2342937 100644 --- a/examples/qml/referenceexamples/valuesource/birthdayparty.h +++ b/examples/qml/referenceexamples/valuesource/birthdayparty.h @@ -60,6 +60,7 @@ class BirthdayPartyAttached : public QObject  {      Q_OBJECT      Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) +    QML_ANONYMOUS  public:      BirthdayPartyAttached(QObject *object); @@ -79,6 +80,8 @@ class BirthdayParty : public QObject      Q_PROPERTY(QString announcement READ announcement WRITE setAnnouncement)  // ![0]      Q_CLASSINFO("DefaultProperty", "guests") +    QML_ELEMENT +    QML_ATTACHED(BirthdayPartyAttached)  public:      BirthdayParty(QObject *parent = nullptr); @@ -102,6 +105,5 @@ private:      Person *m_host;      QList<Person *> m_guests;  }; -QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)  #endif // BIRTHDAYPARTY_H diff --git a/examples/qml/referenceexamples/valuesource/main.cpp b/examples/qml/referenceexamples/valuesource/main.cpp index 4bef695fe2..72e75fdea1 100644 --- a/examples/qml/referenceexamples/valuesource/main.cpp +++ b/examples/qml/referenceexamples/valuesource/main.cpp @@ -59,13 +59,8 @@ int main(int argc, char ** argv)  {      QCoreApplication app(argc, argv); -    qmlRegisterType<BirthdayPartyAttached>(); -    qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty"); -    qmlRegisterType<HappyBirthdaySong>("People", 1,0, "HappyBirthdaySong"); -    qmlRegisterType<ShoeDescription>(); -    qmlRegisterType<Person>(); -    qmlRegisterType<Boy>("People", 1,0, "Boy"); -    qmlRegisterType<Girl>("People", 1,0, "Girl"); +    qmlRegisterTypesAndRevisions<BirthdayPartyAttached, BirthdayParty, HappyBirthdaySong, +                                 ShoeDescription, Person, Boy, Girl>("People", 1);      QQmlEngine engine;      QQmlComponent component(&engine, QUrl("qrc:example.qml")); @@ -95,9 +90,9 @@ int main(int argc, char ** argv)          }          party->startParty(); -    } else { -        qWarning() << component.errors(); +        return QCoreApplication::exec();      } -    return app.exec(); +    qWarning() << component.errors(); +    return EXIT_FAILURE;  } diff --git a/examples/qml/referenceexamples/valuesource/person.h b/examples/qml/referenceexamples/valuesource/person.h index 06d4f2eb27..7283f39f61 100644 --- a/examples/qml/referenceexamples/valuesource/person.h +++ b/examples/qml/referenceexamples/valuesource/person.h @@ -52,6 +52,7 @@  #include <QObject>  #include <QColor> +#include <QtQml/qqml.h>  class ShoeDescription : public QObject  { @@ -60,6 +61,7 @@ class ShoeDescription : public QObject      Q_PROPERTY(QColor color READ color WRITE setColor)      Q_PROPERTY(QString brand READ brand WRITE setBrand)      Q_PROPERTY(qreal price READ price WRITE setPrice) +    QML_ANONYMOUS  public:      ShoeDescription(QObject *parent = nullptr); @@ -86,6 +88,7 @@ class Person : public QObject      Q_OBJECT      Q_PROPERTY(QString name READ name WRITE setName)      Q_PROPERTY(ShoeDescription *shoe READ shoe) +    QML_ANONYMOUS  public:      Person(QObject *parent = nullptr); @@ -101,6 +104,7 @@ private:  class Boy : public Person  {      Q_OBJECT +    QML_ELEMENT  public:      Boy(QObject * parent = nullptr);  }; @@ -108,6 +112,7 @@ public:  class Girl : public Person  {      Q_OBJECT +    QML_ELEMENT  public:      Girl(QObject * parent = nullptr);  };  | 
