QMetaType Class Reference |
Constant | Value | Description |
---|---|---|
QMetaType::Void | 0 | void |
QMetaType::Bool | 1 | bool |
QMetaType::Int | 2 | int |
QMetaType::UInt | 3 | unsigned int |
QMetaType::Double | 6 | double |
QMetaType::QChar | 7 | QChar |
QMetaType::QString | 10 | QString |
QMetaType::QByteArray | 12 | QByteArray |
QMetaType::VoidStar | 128 | void * |
QMetaType::Long | 129 | long |
QMetaType::Short | 130 | short |
QMetaType::Char | 131 | char |
QMetaType::ULong | 132 | unsigned long |
QMetaType::UShort | 133 | unsigned short |
QMetaType::UChar | 134 | unsigned char |
QMetaType::Float | 135 | float |
QMetaType::QObjectStar | 136 | QObject * |
QMetaType::QWidgetStar | 137 | QWidget * |
QMetaType::User | 256 | Base value for user types |
Additional types can be registered using qRegisterMetaType().
See also type() and typeName().
Returns a copy of copy, assuming it is of type type. If copy is zero, creates a default type.
See also destroy(), isRegistered(), and Type.
Destroys the data, assuming it is of the type given.
See also construct(), isRegistered(), and Type.
Returns true if the custom datatype with ID type is registered; otherwise returns false.
See also type(), typeName(), and Type.
Returns a handle to the type called typeName, or 0 if there is no such type.
See also isRegistered(), typeName(), and Type.
Returns the type name associated with the given type, or 0 if no matching type was found. The returned pointer must not be deleted.
See also type(), isRegistered(), and Type.
Registers the type name typeName to the type T. Returns the internal ID used by QMetaType. Any class or struct that has a public constructor, a public copy constructor, and a public destructor can be registered.
After a type has been registered, you can create and destroy objects of that type dynamically at run-time.
This example registers the class MyClass:
qRegisterMetaType<MyClass>("MyClass");
You don't need to pass any value for the dummy parameter. It is there because of an MSVC 6 limitation.
See also QMetaType::isRegistered() and Q_DECLARE_METATYPE().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
This macro makes the type Type known to QMetaType. 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.
Q_DECLARE_METATYPE() doesn't actually register the type; you must still use qRegisterMetaType() for that.
See also qRegisterMetaType().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.0 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com