diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-07-23 06:22:35 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-07-23 06:22:35 (GMT) |
commit | 7fe100b56ccca40de193164d3ce19600cf50bdd4 (patch) | |
tree | 9563d91fe63af272dee0dd18be42e6159de48cf0 | |
parent | fff9aec87509bdcf3c662889b5119f97d32332e5 (diff) | |
download | Qt-7fe100b56ccca40de193164d3ce19600cf50bdd4.zip Qt-7fe100b56ccca40de193164d3ce19600cf50bdd4.tar.gz Qt-7fe100b56ccca40de193164d3ce19600cf50bdd4.tar.bz2 |
Doc and example fixes for library qualification (QT-558)
24 files changed, 40 insertions, 39 deletions
diff --git a/doc/src/declarative/cppitem.qdoc b/doc/src/declarative/cppitem.qdoc index d212a5e..97aae67 100644 --- a/doc/src/declarative/cppitem.qdoc +++ b/doc/src/declarative/cppitem.qdoc @@ -65,7 +65,7 @@ In order for your type to be usable in QML, you must register it: \code QML_DECLARE_TYPE(TypeName); -QML_DEFINE_TYPE(TypeName,QmlName); +QML_DEFINE_TYPE(ModuleUri,ModuleMajorVersion,ModuleMinorVersionFrom,ModuleMinorVersionTo,QmlName,TypeName); \endcode These macros make the C++ \e TypeName available from the declarative markup language under the name \e QmlName. @@ -74,9 +74,9 @@ Of course there's nothing stopping you using the same name for both the C++ and For example: \code QML_DECLARE_TYPE(MyCircle); -QML_DEFINE_TYPE(MyCircle,Circle); +QML_DEFINE_TYPE(MyLib,1,0,5,Circle,MyCircle); \endcode -would make the \e MyCircle class accessable though the \c Circle type in QML. +would make the \e MyCircle class accessable though the \c Circle type in QML whenever MyLib 1.0 to 1.5 is imported. \section1 Creating a new 'Fx' item in C++ diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc index 4fc1bee..17bef4e 100644 --- a/doc/src/declarative/extending-examples.qdoc +++ b/doc/src/declarative/extending-examples.qdoc @@ -70,8 +70,8 @@ The Person class implementation is quite basic. The property accessors simply return members of the object instance. The implementation must also include the QML_DEFINE_TYPE() macro. This macro -registers the Person class with QML, and defines the mapping between the C++ -and QML class names. +registers the Person class with QML as a type in the People library version 1.0, +and defines the mapping between the C++ and QML class names. \section1 Running the example diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index ac3dc41..88abfe6 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -71,11 +71,12 @@ Custom C++ types are made available to QML using these two macros: \quotation \code #define QML_DECLARE_TYPE(T) -#define QML_DEFINE_TYPE(T,QmlName) +#define QML_DEFINE_TYPE(URI,VMAJ,VFROM,VTO,QmlName,T) \endcode Register the C++ type \a T with the QML system, and make it available in QML -under the name \a QmlName. \a T and \a QmlName may be the same. +under the name \a QmlName in library URI version VMAJ.VFROM to VMAJ.VTO. +\a T and \a QmlName may be the same. Generally the QML_DECLARE_TYPE() macro should be included immediately following the type declaration (usually in its header file), and the QML_DEFINE_TYPE() diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc index c0d1b7d..74357bb 100644 --- a/doc/src/declarative/qmlforcpp.qdoc +++ b/doc/src/declarative/qmlforcpp.qdoc @@ -173,12 +173,12 @@ \section1 Defining QML Types The QML engine has no intrinsic knowledge of any class types. Instead - the programmer must define the C++ types, and their corresponding QML - name. + the programmer must define the C++ types, their corresponding QML + name, library namespace, and version availability. \code #define QML_DECLARE_TYPE(T) - #define QML_DEFINE_TYPE(T,QmlName) + #define QML_DEFINE_TYPE(URI,VMAJ,VFROM,VTO,QmlName,T) \endcode Adding these macros to your library or executable automatically makes the diff --git a/examples/declarative/extending/adding/person.cpp b/examples/declarative/extending/adding/person.cpp index 4198b63..ccf08b3 100644 --- a/examples/declarative/extending/adding/person.cpp +++ b/examples/declarative/extending/adding/person.cpp @@ -26,5 +26,5 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -QML_DEFINE_TYPE(Person, Person); +QML_DEFINE_TYPE(People, 1, 0, 0, Person, Person); // ![0] diff --git a/examples/declarative/extending/attached/birthdayparty.cpp b/examples/declarative/extending/attached/birthdayparty.cpp index 49ed5a3..2c4c218 100644 --- a/examples/declarative/extending/attached/birthdayparty.cpp +++ b/examples/declarative/extending/attached/birthdayparty.cpp @@ -42,4 +42,4 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/attached/person.cpp b/examples/declarative/extending/attached/person.cpp index 48a94e8..eeedd1d 100644 --- a/examples/declarative/extending/attached/person.cpp +++ b/examples/declarative/extending/attached/person.cpp @@ -73,11 +73,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/extending/binding/birthdayparty.cpp b/examples/declarative/extending/binding/birthdayparty.cpp index 6ede183..b4f09eb 100644 --- a/examples/declarative/extending/binding/birthdayparty.cpp +++ b/examples/declarative/extending/binding/birthdayparty.cpp @@ -63,4 +63,4 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/binding/happybirthday.cpp b/examples/declarative/extending/binding/happybirthday.cpp index 81e010e..d1f485e 100644 --- a/examples/declarative/extending/binding/happybirthday.cpp +++ b/examples/declarative/extending/binding/happybirthday.cpp @@ -44,4 +44,4 @@ void HappyBirthday::advance() m_target.write(m_lyrics.at(m_line)); } -QML_DEFINE_TYPE(HappyBirthday, HappyBirthday); +QML_DEFINE_TYPE(People, 1, 0, 0, HappyBirthday, HappyBirthday); diff --git a/examples/declarative/extending/binding/person.cpp b/examples/declarative/extending/binding/person.cpp index 149669a..849b3de 100644 --- a/examples/declarative/extending/binding/person.cpp +++ b/examples/declarative/extending/binding/person.cpp @@ -93,11 +93,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/extending/coercion/birthdayparty.cpp b/examples/declarative/extending/coercion/birthdayparty.cpp index cdff6e1..ea97f548 100644 --- a/examples/declarative/extending/coercion/birthdayparty.cpp +++ b/examples/declarative/extending/coercion/birthdayparty.cpp @@ -20,4 +20,4 @@ QmlList<Person *> *BirthdayParty::guests() return &m_guests; } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/coercion/person.cpp b/examples/declarative/extending/coercion/person.cpp index 4605db9..d075851 100644 --- a/examples/declarative/extending/coercion/person.cpp +++ b/examples/declarative/extending/coercion/person.cpp @@ -35,12 +35,12 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); // ![1] diff --git a/examples/declarative/extending/default/birthdayparty.cpp b/examples/declarative/extending/default/birthdayparty.cpp index cdff6e1..ea97f548 100644 --- a/examples/declarative/extending/default/birthdayparty.cpp +++ b/examples/declarative/extending/default/birthdayparty.cpp @@ -20,4 +20,4 @@ QmlList<Person *> *BirthdayParty::guests() return &m_guests; } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/default/person.cpp b/examples/declarative/extending/default/person.cpp index c47bfb7..7c468c6 100644 --- a/examples/declarative/extending/default/person.cpp +++ b/examples/declarative/extending/default/person.cpp @@ -32,11 +32,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/extending/grouped/birthdayparty.cpp b/examples/declarative/extending/grouped/birthdayparty.cpp index cdff6e1..ea97f548 100644 --- a/examples/declarative/extending/grouped/birthdayparty.cpp +++ b/examples/declarative/extending/grouped/birthdayparty.cpp @@ -20,4 +20,4 @@ QmlList<Person *> *BirthdayParty::guests() return &m_guests; } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/grouped/person.cpp b/examples/declarative/extending/grouped/person.cpp index 48a94e8..eeedd1d 100644 --- a/examples/declarative/extending/grouped/person.cpp +++ b/examples/declarative/extending/grouped/person.cpp @@ -73,11 +73,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/extending/properties/person.cpp b/examples/declarative/extending/properties/person.cpp index cf66a30..99fa33e 100644 --- a/examples/declarative/extending/properties/person.cpp +++ b/examples/declarative/extending/properties/person.cpp @@ -25,4 +25,4 @@ void Person::setShoeSize(int s) m_shoeSize = s; } -QML_DEFINE_TYPE(Person, Person); +QML_DEFINE_TYPE(People, 1, 0, 0, Person, Person); diff --git a/examples/declarative/extending/signal/birthdayparty.cpp b/examples/declarative/extending/signal/birthdayparty.cpp index ceb5e15..d6a0d56 100644 --- a/examples/declarative/extending/signal/birthdayparty.cpp +++ b/examples/declarative/extending/signal/birthdayparty.cpp @@ -48,4 +48,4 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/signal/person.cpp b/examples/declarative/extending/signal/person.cpp index 48a94e8..eeedd1d 100644 --- a/examples/declarative/extending/signal/person.cpp +++ b/examples/declarative/extending/signal/person.cpp @@ -73,11 +73,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/extending/valuesource/birthdayparty.cpp b/examples/declarative/extending/valuesource/birthdayparty.cpp index 9132ee7..6bca2ef 100644 --- a/examples/declarative/extending/valuesource/birthdayparty.cpp +++ b/examples/declarative/extending/valuesource/birthdayparty.cpp @@ -58,4 +58,4 @@ BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object) return new BirthdayPartyAttached(object); } -QML_DEFINE_TYPE(BirthdayParty, BirthdayParty); +QML_DEFINE_TYPE(People, 1, 0, 0, BirthdayParty, BirthdayParty); diff --git a/examples/declarative/extending/valuesource/happybirthday.cpp b/examples/declarative/extending/valuesource/happybirthday.cpp index 1ed309c..905dc51 100644 --- a/examples/declarative/extending/valuesource/happybirthday.cpp +++ b/examples/declarative/extending/valuesource/happybirthday.cpp @@ -39,4 +39,4 @@ void HappyBirthday::advance() m_target.write(m_lyrics.at(m_line)); } -QML_DEFINE_TYPE(HappyBirthday, HappyBirthday); +QML_DEFINE_TYPE(People, 1, 0, 0, HappyBirthday, HappyBirthday); diff --git a/examples/declarative/extending/valuesource/person.cpp b/examples/declarative/extending/valuesource/person.cpp index 48a94e8..eeedd1d 100644 --- a/examples/declarative/extending/valuesource/person.cpp +++ b/examples/declarative/extending/valuesource/person.cpp @@ -73,11 +73,11 @@ Boy::Boy(QObject * parent) { } -QML_DEFINE_TYPE(Boy, Boy); +QML_DEFINE_TYPE(People, 1, 0, 0, Boy, Boy); Girl::Girl(QObject * parent) : Person(parent) { } -QML_DEFINE_TYPE(Girl, Girl); +QML_DEFINE_TYPE(People, 1, 0, 0, Girl, Girl); diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp index ae850de..20f7492 100644 --- a/examples/declarative/minehunt/main.cpp +++ b/examples/declarative/minehunt/main.cpp @@ -52,7 +52,7 @@ private: }; QML_DECLARE_TYPE(Tile); -QML_DEFINE_TYPE(Tile,Tile); +QML_DEFINE_TYPE(0,0,0,0,Tile,Tile); class MyWidget : public QWidget { diff --git a/examples/declarative/support/contact.cpp b/examples/declarative/support/contact.cpp index 7d90fc4..0821295 100644 --- a/examples/declarative/support/contact.cpp +++ b/examples/declarative/support/contact.cpp @@ -14,7 +14,7 @@ #include "contact.h" #include "qmltypes.h" -QML_DEFINE_TYPE(Contact,Contact); +QML_DEFINE_TYPE(0,0,0,0,Contact,Contact); Contact::Contact() : QObject(0) { m_firstName = "John"; @@ -70,13 +70,13 @@ void Contact::addEmail(QString &newEmail) emit emailsChanged(); } -QML_DEFINE_TYPE(Address,Address); +QML_DEFINE_TYPE(0,0,0,0,Address,Address); Address::Address() : _number(0) { } -QML_DEFINE_TYPE(PhoneNumber, PhoneNumber); +QML_DEFINE_TYPE(0,0,0,0,PhoneNumber, PhoneNumber); PhoneNumber::PhoneNumber() : _type(HomePhone) { |