Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QMetaProperty Class Reference
[QtCore module]

The QMetaProperty class provides meta-data about a property. More...

 #include <QMetaProperty>

Public Functions


Detailed Description

The QMetaProperty class provides meta-data about a property.

A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored().

If the property is an enumeration, isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator), isEnumType() and isFlagType() both return true. The enumerator for these types is available from enumerator().

The property's values are set and retrieved with read(), write(), and reset(); they can also be changed through QObject's set and get functions. See QObject::setProperty() and QObject::property() for details.

You get property meta-data through an object's meta-object. See QMetaObject::property() and QMetaObject::propertyCount() for details.

See also QMetaObject, QMetaEnum, QMetaMethod, and Qt's Property System.


Member Function Documentation

QMetaEnum QMetaProperty::enumerator () const

Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.

See also isEnumType() and isFlagType().

bool QMetaProperty::isDesignable ( const QObject * object = 0 ) const

Returns true if this property is designable for the given object; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY()'s DESIGNABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See also isScriptable() and isStored().

bool QMetaProperty::isEnumType () const

Returns true if the property's type is an enumeration value; otherwise returns false.

See also enumerator() and isFlagType().

bool QMetaProperty::isFlagType () const

Returns true if the property's type is an enumeration value that is used as a flag; otherwise returns false.

Flags can be combined using the OR operator. A flag type is implicitly also an enum type.

See also isEnumType(), enumerator(), and QMetaEnum::isFlag().

bool QMetaProperty::isReadable () const

Returns true if this property is readable; otherwise returns false.

See also isWritable(), read(), and isValid().

bool QMetaProperty::isResettable () const

Returns true if this property can be reset to a default value; otherwise returns false.

See also reset().

bool QMetaProperty::isScriptable ( const QObject * object = 0 ) const

Returns true if the property is scriptable for the given object; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY()'s SCRIPTABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See also isDesignable() and isStored().

bool QMetaProperty::isStored ( const QObject * object = 0 ) const

Returns true if the property is stored for object; otherwise returns false.

If no object is given, the function returns false if the Q_PROPERTY()'s STORED attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See also isDesignable() and isScriptable().

bool QMetaProperty::isUser ( const QObject * object = 0 ) const

Returns true if this is the property that the user can editable for object; otherwise returns false. I.e. the text property is the user editable property of a QLineEdit.

If no object is given, the function returns false if the Q_PROPERTY()'s USER attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See also QMetaObject::userProperty(), isDesignable(), and isScriptable().

bool QMetaProperty::isValid () const

Returns true if this property is valid (readable); otherwise returns false.

See also isReadable().

bool QMetaProperty::isWritable () const

Returns true if this property is writable; otherwise returns false.

See also isReadable() and write().

const char * QMetaProperty::name () const

Returns this property's name.

See also type() and typeName().

QVariant QMetaProperty::read ( const QObject * object ) const

Reads the property's value from the given object. Returns the value if it was able to read it; otherwise returns an invalid variant.

See also write(), reset(), and isReadable().

bool QMetaProperty::reset ( QObject * object ) const

Resets the property for the given object with a reset method. Returns true if the reset worked; otherwise returns false.

Reset methods are optional; only a few properties support them.

See also read() and write().

QVariant::Type QMetaProperty::type () const

Returns this property's type. The return value is one of the values of the QVariant::Type enumeration.

See also userType(), typeName(), and name().

const char * QMetaProperty::typeName () const

Returns the name of this property's type.

See also type() and name().

int QMetaProperty::userType () const

Returns this property's user type. The return value is one of the values that are registered with QMetaType, or 0 if the type is not registered.

This function was introduced in Qt 4.2.

See also type(), QMetaType, and typeName().

bool QMetaProperty::write ( QObject * object, const QVariant & value ) const

Writes value as the property's value to the given object. Returns true if the write succeeded; otherwise returns false.

See also read(), reset(), and isWritable().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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.2
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 !
 
 
 
 
Partenaires

Hébergement Web