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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMetaEnum Class Reference

The QMetaEnum class provides meta-data about an enumerator. More...

 #include <QMetaEnum>

Public Functions

bool isFlag () const
bool isValid () const
const char * key ( int index ) const
int keyCount () const
int keyToValue ( const char * key ) const
int keysToValue ( const char * keys ) const
const char * name () const
const char * scope () const
int value ( int index ) const
const char * valueToKey ( int value ) const
QByteArray valueToKeys ( int value ) const

Detailed Description

The QMetaEnum class provides meta-data about an enumerator.

Use name() for the enumerator's name. The enumerator's keys (names of each enumerated item) are returned by key(); use keyCount() to find the number of keys. isFlag() returns whether the enumerator is meant to be used as a flag, meaning that its values can be combined using the OR operator.

The conversion functions keyToValue(), valueToKey(), keysToValue(), and valueToKeys() allow conversion between the integer representation of an enumeration or set value and its literal representation. The scope() function returns the class scope this enumerator was declared in.

See also QMetaObject, QMetaMethod, and QMetaProperty.

Member Function Documentation

bool QMetaEnum::isFlag () const

Returns true if this enumerator is used as a flag; otherwise returns false.

When used as flags, enumerators can be combined using the OR operator.

See also keysToValue() and valueToKeys().

bool QMetaEnum::isValid () const

Returns true if this enum is valid (has a name); otherwise returns false.

See also name().

const char * QMetaEnum::key ( int index ) const

Returns the key with the given index, or 0 if no such key exists.

See also keyCount(), value(), and valueToKey().

int QMetaEnum::keyCount () const

Returns the number of keys.

See also key().

int QMetaEnum::keyToValue ( const char * key ) const

Returns the integer value of the given enumeration key, or -1 if key is not defined.

For flag types, use keysToValue().

See also valueToKey(), isFlag(), and keysToValue().

int QMetaEnum::keysToValue ( const char * keys ) const

Returns the value derived from combining together the values of the keys using the OR operator, or -1 if keys is not defined. Note that the strings in keys must be '|'-separated.

See also isFlag(), valueToKey(), and valueToKeys().

const char * QMetaEnum::name () const

Returns the name of the enumerator (without the scope).

For example, the Qt::AlignmentFlag enumeration has AlignmentFlag as the name and Qt as the scope.

See also isValid() and scope().

const char * QMetaEnum::scope () const

Returns the scope this enumerator was declared in.

For example, the Qt::AlignmentFlag enumeration has Qt as the scope and AlignmentFlag as the name.

See also name().

int QMetaEnum::value ( int index ) const

Returns the value with the given index; or returns -1 if there is no such value.

See also keyCount(), key(), and keyToValue().

const char * QMetaEnum::valueToKey ( int value ) const

Returns the string that is used as the name of the given enumeration value, or 0 if value is not defined.

For flag types, use valueToKeys().

See also isFlag() and valueToKeys().

QByteArray QMetaEnum::valueToKeys ( int value ) const

Returns a byte array of '|'-separated keys that represents the given value.

See also isFlag(), valueToKey(), and keysToValue().

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.8
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