Qt 4.8
|
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
#include <QtCore/qdatastream.h>
Go to the source code of this file.
Classes | |
class | QMetaType |
The QMetaType class manages named types in the meta-object system. More... | |
struct | QMetaTypeId< T > |
struct | QMetaTypeId2< T > |
struct | QtPrivate::QMetaTypeIdHelper< T, Defined > |
struct | QtPrivate::QMetaTypeIdHelper< T, false > |
Namespaces | |
QtPrivate | |
Macros | |
#define | Q_DECLARE_BUILTIN_METATYPE(TYPE, NAME) |
#define | Q_DECLARE_METATYPE(TYPE) |
This macro makes the type Type known to QMetaType as long as it provides a public default constructor, a public copy constructor and a public destructor. More... | |
Functions | |
template<typename T > | |
void * | qMetaTypeConstructHelper (const T *t) |
template<typename T > | |
void | qMetaTypeDeleteHelper (T *t) |
template<typename T > | |
int | qMetaTypeId () |
template<typename T > | |
void | qMetaTypeLoadHelper (QDataStream &stream, T *t) |
template<typename T > | |
void | qMetaTypeSaveHelper (QDataStream &stream, const T *t) |
template<typename T > | |
int | qRegisterMetaType (const char *typeName) |
template<typename T > | |
int | qRegisterMetaType () |
template<typename T > | |
void | qRegisterMetaTypeStreamOperators (const char *typeName) |
template<typename T > | |
int | qRegisterMetaTypeStreamOperators () |
#define Q_DECLARE_BUILTIN_METATYPE | ( | TYPE, | |
NAME | |||
) |
Definition at line 282 of file qmetatype.h.
Referenced by qVariantCanConvert().
#define Q_DECLARE_METATYPE | ( | TYPE | ) |
This macro makes the type Type known to QMetaType as long as it provides a public default constructor, a public copy constructor and a public destructor.
It is needed to use the type Type as a custom type in QVariant.
Ideally, this macro should be placed below the declaration of the class or struct. If that is not possible, it can be put in a private header file which has to be included every time that type is used in a QVariant.
Adding a Q_DECLARE_METATYPE() makes the type known to all template based functions, including QVariant. Note that if you intend to use the type in queued signal and slot connections or in QObject's property system, you also have to call qRegisterMetaType() since the names are resolved at runtime.
This example shows a typical use case of Q_DECLARE_METATYPE():
If MyStruct
is in a namespace, the Q_DECLARE_METATYPE() macro has to be outside the namespace:
Since MyStruct
is now known to QMetaType, it can be used in QVariant:
Definition at line 265 of file qmetatype.h.
Referenced by QLocalePrivate::digitToCLocale(), operator<<(), operator==(), operator>>(), PQfreemem(), qgraphicsitem_cast(), qIsForwardIteratorEnd(), qmlAttachedPropertiesObject(), qobject_cast< QAxObject * >(), scriptValueToQDBusError(), QDeclarativeGuard< QDeclarativeTransition >::setObject(), QTextOption::setTabStop(), QTestEventList::simulate(), QLocale::toCurrencyString(), and QDeclarativeBinding::update().
void* qMetaTypeConstructHelper | ( | const T * | t | ) |
Definition at line 138 of file qmetatype.h.
void qMetaTypeDeleteHelper | ( | T * | t | ) |
Definition at line 132 of file qmetatype.h.
|
related |
Definition at line 224 of file qmetatype.h.
Referenced by QScriptEnginePrivate::convertValue(), QScriptEnginePrivate::create(), QDeclarativeVMEMetaObject::metaCall(), QDBusReply< QStringList >::operator=(), QDeclarativeObjectMethodScriptClass::property(), qRegisterMetaType(), QDeclarativeEnginePrivate::scriptValueToVariant(), QDeclarativeObjectScriptClass::setProperty(), QDeclarativeBinding::update(), and QDeclarativeExpressionPrivate::value().
void qMetaTypeLoadHelper | ( | QDataStream & | stream, |
T * | t | ||
) |
Definition at line 153 of file qmetatype.h.
void qMetaTypeSaveHelper | ( | QDataStream & | stream, |
const T * | t | ||
) |
Definition at line 147 of file qmetatype.h.
|
related |
Definition at line 185 of file qmetatype.h.
Referenced by QDeclarativePrivate::qmlRegisterUncreatableType().
|
related |
Definition at line 234 of file qmetatype.h.
|
related |
Definition at line 206 of file qmetatype.h.
|
inline |
Definition at line 249 of file qmetatype.h.