diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-23 23:07:29 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-23 23:07:29 (GMT) |
commit | 8727985d81c793d52d5e24ed6815e7237ae879f1 (patch) | |
tree | dbf3fcdf5c1e16a0ab5fcb79ce4f8ad6450ac353 /doc | |
parent | c38be88e5314f43efd7cb6a2e8140d006e77afbe (diff) | |
download | Qt-8727985d81c793d52d5e24ed6815e7237ae879f1.zip Qt-8727985d81c793d52d5e24ed6815e7237ae879f1.tar.gz Qt-8727985d81c793d52d5e24ed6815e7237ae879f1.tar.bz2 |
Remove QML_DEFINE_... macros, now use QML_REGISTER_... macros calls.
Task-number: QT-2798
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/extending-examples.qdoc | 8 | ||||
-rw-r--r-- | doc/src/declarative/extending.qdoc | 31 |
2 files changed, 18 insertions, 21 deletions
diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc index b84ae0e..b912a1d 100644 --- a/doc/src/declarative/extending-examples.qdoc +++ b/doc/src/declarative/extending-examples.qdoc @@ -69,7 +69,7 @@ Q_DECLARE_METATYPE() functionality. 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 +The implementation must also be registered using the QML_REGISTER_TYPE() macro. This macro 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. @@ -160,13 +160,13 @@ previous example. However, as we have repurposed the People class as a common base for Boy and Girl, we want to prevent it from being instantiated from QML directly - an explicit Boy or Girl should be instantiated instead. -\snippet examples/declarative/extending/coercion/person.cpp 0 +\snippet examples/declarative/extending/coercion/main.cpp 0 While we want to disallow instantiating Person from within QML, it still needs to be registered with the QML engine, so that it can be used as a property type and other types can be coerced to it. To register a type, without defining a -named mapping into QML, we use the QML_DEFINE_NOCREATE_TYPE() macro instead of -the QML_DEFINE_TYPE() macro used previously. +named mapping into QML, we call the QML_REGISTER_NOCREATE_TYPE() macro instead of +the QML_REGISTER_TYPE() macro used previously. \section2 Define Boy and Girl diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index d3e6c14..b40980d 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -72,7 +72,7 @@ Custom C++ types are made available to QML using these two macros: \quotation \code #define QML_DECLARE_TYPE(T) -#define QML_DEFINE_TYPE(URI,VMAJ,VMIN,QmlName,T) +#define QML_REGISTER_TYPE(URI,VMAJ,VMIN,QmlName,T) \endcode Register the C++ type \a T with the QML system, and make it available in QML @@ -80,9 +80,8 @@ under the name \a QmlName in library URI version VMAJ.VMIN. \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() -macro in the implementation file. QML_DEFINE_TYPE() must not be present in -a header file. +the type declaration (usually in its header file), and the QML_REGISTER_TYPE() +macro called by the implementation. Type \a T must be a concrete type that inherits QObject and has a default constructor. @@ -153,15 +152,14 @@ from registering a new QML type. The following macros are used instead: \quotation \code #define QML_DECLARE_INTERFACE(T) - #define QML_DEFINE_INTERFACE(T) + #define QML_REGISTER_INTERFACE(T) \endcode Register the C++ interface \a T with the QML system. Generally the QML_DECLARE_INTERFACE() macro should be included immediately following the interface declaration (usually in its header file), and the -QML_DEFINE_INTERFACE() macro in an implementation file. QML_DEFINE_INTERFACE() -must not be present in a header file. +QML_REGISTER_INTERFACE() macro called by the implementation. Following registration, QML can coerce objects that implement this interface for assignment to appropriately typed properties. @@ -194,7 +192,7 @@ type used in the previous section, but the assignment is valid as both the Boy and Girl objects inherit from Person. To assign to a property, the property's type must have been registered with QML. -Both the QML_DEFINE_TYPE() and QML_DEFINE_INTERFACE() macros already shown can +Both the QML_REGISTER_TYPE() and QML_REGISTER_INTERFACE() macros already shown can be used to register a type with QML. Additionally, if a type that acts purely as a base class that cannot be instantiated from QML needs to be registered these macros can be used: @@ -202,18 +200,17 @@ registered these macros can be used: \quotation \code #define QML_DECLARE_TYPE(T) - #define QML_DEFINE_NOCREATE_TYPE(T) + #define QML_REGISTER_NOCREATE_TYPE(T) \endcode -Register the C++ type \a T with the QML system. QML_DEFINE_NOCREATE_TYPE() -differs from QML_DEFINE_TYPE() in that it does not define a mapping between the +Register the C++ type \a T with the QML system. QML_REGISTER_NOCREATE_TYPE() +differs from QML_REGISTER_TYPE() in that it does not define a mapping between the C++ class and a QML element name, so the type is not instantiable from QML, but it is available for type coercion. Generally the QML_DECLARE_TYPE() macro should be included immediately following the type declaration (usually in its header file), and the -QML_DEFINE_NOCREATE_TYPE() macro in the implementation file. -QML_DEFINE_NOCREATE_TYPE() must not be present in a header file. +QML_REGISTER_NOCREATE_TYPE() macro called from the implementation. Type \a T must inherit QObject, but there are no restrictions on whether it is concrete or the signature of its constructor. @@ -597,11 +594,11 @@ the appropriate property on the extension object is used instead. When an extended type is installed, one of the \code - #define QML_DEFINE_EXTENDED_TYPE(URI, VMAJ, VFROM, VTO, QmlName,T, ExtendedT) - #define QML_DEFINE_EXTENDED_NOCREATE_TYPE(T, ExtendedT) + #define QML_REGISTER_EXTENDED_TYPE(URI, VMAJ, VFROM, VTO, QmlName,T, ExtendedT) + #define QML_REGISTER_EXTENDED_NOCREATE_TYPE(T, ExtendedT) \endcode -macros should be used instead of the regular \c QML_DEFINE_TYPE or -\c QML_DEFINE_NOCREATE_TYPE. The arguments are identical to the corresponding +macros should be used instead of the regular \c QML_REGISTER_TYPE or +\c QML_REGISTER_NOCREATE_TYPE. The arguments are identical to the corresponding non-extension object macro, except for the ExtendedT parameter which is the type of the extension object. |