[][src]Struct qt_core::QMetaEnum

#[repr(C)]pub struct QMetaEnum { /* fields omitted */ }

The QMetaEnum class provides meta-data about an enumerator.

C++ class: QMetaEnum.

C++ documentation:

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.

Methods

impl QMetaEnum[src]

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QMetaEnum>>
) -> Ref<QMetaEnum>
[src]

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: QMetaEnum& QMetaEnum::operator=(const QMetaEnum& other).

C++ documentation:

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.

pub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: const QMetaObject* QMetaEnum::enclosingMetaObject() const.

pub unsafe fn enum_name(&self) -> *const c_char[src]

This is supported on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the enum name of the flag (without the scope).

Calls C++ function: const char* QMetaEnum::enumName() const.

C++ documentation:

Returns the enum name of the flag (without the scope).

For example, the Qt::AlignmentFlag flag has AlignmentFlag as the enum name, but Alignment as as the type name. Non flag enums has the same type and enum names.

Enum names have the same scope as the type name.

This function was introduced in Qt 5.12.

See also isValid() and name().

pub unsafe fn is_flag(&self) -> bool[src]

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

Calls C++ function: bool QMetaEnum::isFlag() const.

C++ documentation:

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().

pub unsafe fn is_scoped(&self) -> bool[src]

Returns true if this enumerator is declared as a C++11 enum class; otherwise returns false.

Calls C++ function: bool QMetaEnum::isScoped() const.

C++ documentation:

Returns true if this enumerator is declared as a C++11 enum class; otherwise returns false.

This function was introduced in Qt 5.8.

pub unsafe fn is_valid(&self) -> bool[src]

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

Calls C++ function: bool QMetaEnum::isValid() const.

C++ documentation:

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

See also name().

pub unsafe fn key(&self, index: c_int) -> *const c_char[src]

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

Calls C++ function: const char* QMetaEnum::key(int index) const.

C++ documentation:

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

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

pub unsafe fn key_count(&self) -> c_int[src]

Returns the number of keys.

Calls C++ function: int QMetaEnum::keyCount() const.

C++ documentation:

Returns the number of keys.

See also key().

pub unsafe fn key_to_value_2a(&self, key: *const c_char, ok: *mut bool) -> c_int[src]

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

Calls C++ function: int QMetaEnum::keyToValue(const char* key, bool* ok = …) const.

C++ documentation:

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

If key is not defined, *ok is set to false; otherwise *ok is set to true.

For flag types, use keysToValue().

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

pub unsafe fn key_to_value_1a(&self, key: *const c_char) -> c_int[src]

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

Calls C++ function: int QMetaEnum::keyToValue(const char* key) const.

C++ documentation:

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

If key is not defined, *ok is set to false; otherwise *ok is set to true.

For flag types, use keysToValue().

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

pub unsafe fn keys_to_value_2a(
    &self,
    keys: *const c_char,
    ok: *mut bool
) -> c_int
[src]

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.

Calls C++ function: int QMetaEnum::keysToValue(const char* keys, bool* ok = …) const.

C++ documentation:

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.

If keys is not defined, *ok is set to false; otherwise *ok is set to true.

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

pub unsafe fn keys_to_value_1a(&self, keys: *const c_char) -> c_int[src]

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.

Calls C++ function: int QMetaEnum::keysToValue(const char* keys) const.

C++ documentation:

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.

If keys is not defined, *ok is set to false; otherwise *ok is set to true.

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

pub unsafe fn name(&self) -> *const c_char[src]

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

Calls C++ function: const char* QMetaEnum::name() const.

C++ documentation:

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().

pub unsafe fn new() -> CppBox<QMetaEnum>[src]

Calls C++ function: [constructor] void QMetaEnum::QMetaEnum().

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QMetaEnum>>
) -> CppBox<QMetaEnum>
[src]

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: [constructor] void QMetaEnum::QMetaEnum(const QMetaEnum& other).

C++ documentation:

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.

pub unsafe fn scope(&self) -> *const c_char[src]

Returns the scope this enumerator was declared in.

Calls C++ function: const char* QMetaEnum::scope() const.

C++ documentation:

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().

pub unsafe fn value(&self, index: c_int) -> c_int[src]

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

Calls C++ function: int QMetaEnum::value(int index) const.

C++ documentation:

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

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

pub unsafe fn value_to_key(&self, value: c_int) -> *const c_char[src]

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

Calls C++ function: const char* QMetaEnum::valueToKey(int value) const.

C++ documentation:

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().

pub unsafe fn value_to_keys(&self, value: c_int) -> CppBox<QByteArray>[src]

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

Calls C++ function: QByteArray QMetaEnum::valueToKeys(int value) const.

C++ documentation:

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

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

Trait Implementations

impl CppDeletable for QMetaEnum[src]

unsafe fn delete(&self)[src]

The QMetaEnum class provides meta-data about an enumerator.

Calls C++ function: [destructor] void QMetaEnum::~QMetaEnum().

C++ documentation:

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.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.