summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-07-23 16:22:35 +1000
committerWarwick Allison <warwick.allison@nokia.com>2009-07-23 16:22:35 +1000
commit7fe100b56ccca40de193164d3ce19600cf50bdd4 (patch)
tree9563d91fe63af272dee0dd18be42e6159de48cf0
parentfff9aec87509bdcf3c662889b5119f97d32332e5 (diff)
downloadqt4-tools-7fe100b56ccca40de193164d3ce19600cf50bdd4.tar.gz
Doc and example fixes for library qualification (QT-558)
-rw-r--r--doc/src/declarative/cppitem.qdoc6
-rw-r--r--doc/src/declarative/extending-examples.qdoc4
-rw-r--r--doc/src/declarative/extending.qdoc5
-rw-r--r--doc/src/declarative/qmlforcpp.qdoc6
-rw-r--r--examples/declarative/extending/adding/person.cpp2
-rw-r--r--examples/declarative/extending/attached/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/attached/person.cpp4
-rw-r--r--examples/declarative/extending/binding/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/binding/happybirthday.cpp2
-rw-r--r--examples/declarative/extending/binding/person.cpp4
-rw-r--r--examples/declarative/extending/coercion/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/coercion/person.cpp4
-rw-r--r--examples/declarative/extending/default/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/default/person.cpp4
-rw-r--r--examples/declarative/extending/grouped/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/grouped/person.cpp4
-rw-r--r--examples/declarative/extending/properties/person.cpp2
-rw-r--r--examples/declarative/extending/signal/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/signal/person.cpp4
-rw-r--r--examples/declarative/extending/valuesource/birthdayparty.cpp2
-rw-r--r--examples/declarative/extending/valuesource/happybirthday.cpp2
-rw-r--r--examples/declarative/extending/valuesource/person.cpp4
-rw-r--r--examples/declarative/minehunt/main.cpp2
-rw-r--r--examples/declarative/support/contact.cpp6
24 files changed, 40 insertions, 39 deletions
diff --git a/doc/src/declarative/cppitem.qdoc b/doc/src/declarative/cppitem.qdoc
index d212a5e448..97aae67252 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 4fc1beeaa0..17bef4ecac 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 ac3dc4187c..88abfe6531 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 c0d1b7d3a5..74357bbcbd 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 4198b63fdc..ccf08b385f 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 49ed5a3201..2c4c218221 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 48a94e8dac..eeedd1dea8 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 6ede183ce5..b4f09eb88e 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 81e010e0ce..d1f485e564 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 149669a73d..849b3de958 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 cdff6e1981..ea97f54827 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 4605db99bf..d075851d4c 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 cdff6e1981..ea97f54827 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 c47bfb74a5..7c468c6fc9 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 cdff6e1981..ea97f54827 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 48a94e8dac..eeedd1dea8 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 cf66a30caf..99fa33e823 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 ceb5e15010..d6a0d5681f 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 48a94e8dac..eeedd1dea8 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 9132ee7583..6bca2ef355 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 1ed309ce47..905dc5198b 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 48a94e8dac..eeedd1dea8 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 ae850de929..20f7492984 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 7d90fc4fb1..082129572b 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)
{