From 8c1bffc7fa73e5249046bae949069bf8df23b78d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 26 Oct 2009 13:55:18 +1000 Subject: Docs. --- doc/src/declarative/extending.qdoc | 15 +++++++++++++-- doc/src/declarative/qtdeclarative.qdoc | 1 + examples/declarative/extending/attached/birthdayparty.h | 8 +++++--- examples/declarative/extending/binding/birthdayparty.h | 8 +++++--- examples/declarative/extending/signal/birthdayparty.h | 8 +++++--- .../declarative/extending/valuesource/birthdayparty.h | 8 +++++--- src/declarative/fx/qfxgridview.cpp | 5 ++--- src/declarative/fx/qfxlistview.cpp | 5 ++--- 8 files changed, 38 insertions(+), 20 deletions(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index db35961..b872632 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -300,11 +300,22 @@ attachment object are those that become available for use as the attached property block. Any QML type can become an attaching type by declaring the -\c qmlAttachedProperties() public function: +\c qmlAttachedProperties() public function and declaring that the class has +QML_HAS_ATTACHED_PROPERTIES: \quotation \code -static AttachedPropertiesType *qmlAttachedProperties(QObject *object) +class MyType : public QObject { + Q_OBJECT +public: + + ... + + static AttachedPropertiesType *qmlAttachedProperties(QObject *object); +}; + +QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(MyType) \endcode Return an attachment object, of type \a AttachedPropertiesType, for the attachee \a object instance. It is customary, though not strictly required, for diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 7be98db..ba2d70e 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -84,6 +84,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+ \o \l {QML Documents} \o \l {Property Binding} \o \l {ECMAScript Blocks} +\o \l {QML Scope} \o \l {Network Transparency} \o \l {qmlmodels}{Data Models} \o \l {anchor-layout}{Anchor-based Layout} diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h index 8249af5..2ea065c 100644 --- a/examples/declarative/extending/attached/birthdayparty.h +++ b/examples/declarative/extending/attached/birthdayparty.h @@ -9,7 +9,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -19,7 +19,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -40,6 +40,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h index 6905746..2757561 100644 --- a/examples/declarative/extending/binding/birthdayparty.h +++ b/examples/declarative/extending/binding/birthdayparty.h @@ -10,7 +10,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged) public: BirthdayPartyAttached(QObject *object); @@ -23,7 +23,7 @@ signals: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -56,6 +56,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h index 14d7c29..5dea2e8 100644 --- a/examples/declarative/extending/signal/birthdayparty.h +++ b/examples/declarative/extending/signal/birthdayparty.h @@ -9,7 +9,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -19,7 +19,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -47,6 +47,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h index fd25f28..75a2477 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.h +++ b/examples/declarative/extending/valuesource/birthdayparty.h @@ -10,7 +10,7 @@ class BirthdayPartyAttached : public QObject { Q_OBJECT -Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp) public: BirthdayPartyAttached(QObject *object); @@ -20,7 +20,7 @@ public: private: QDate m_rsvp; }; -QML_DECLARE_TYPE(BirthdayPartyAttached); +QML_DECLARE_TYPE(BirthdayPartyAttached) class BirthdayParty : public QObject { @@ -52,6 +52,8 @@ private: Person *m_celebrant; QmlConcreteList m_guests; }; -QML_DECLARE_TYPE(BirthdayParty); + +QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(BirthdayParty) #endif // BIRTHDAYPARTY_H diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 36c06a4..0b2a935 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -736,14 +736,13 @@ QFxGridView::~QFxGridView() \endcode */ -//XXX change to \qmlattachedsignal when it exists. /*! - \qmlattachedproperty void GridView::onAdd + \qmlattachedsignal GridView::onAdd() This attached handler is called immediately after an item is added to the view. */ /*! - \qmlattachedproperty void GridView::onRemove + \qmlattachedsignal GridView::onRemove() This attached handler is called immediately before an item is removed from the view. */ diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 23bf573..1a4a60c 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -926,14 +926,13 @@ QFxListView::~QFxListView() \endcode */ -//XXX change to \qmlattachedsignal when it exists. /*! - \qmlattachedproperty void ListView::onAdd + \qmlattachedsignal ListView::onAdd() This attached handler is called immediately after an item is added to the view. */ /*! - \qmlattachedproperty void ListView::onRemove + \qmlattachedsignal ListView::onRemove() This attached handler is called immediately before an item is removed from the view. */ -- cgit v0.12