#[repr(C)]pub struct QMetaEnum { /* private fields */ }
Expand description
The QMetaEnum class provides meta-data about an enumerator.
C++ class: QMetaEnum
.
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.
Implementations§
source§impl QMetaEnum
impl QMetaEnum
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QMetaEnum>>
) -> Ref<QMetaEnum>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QMetaEnum>> ) -> Ref<QMetaEnum>
The QMetaEnum class provides meta-data about an enumerator.
Calls C++ function: QMetaEnum& QMetaEnum::operator=(const QMetaEnum& other)
.
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.
sourcepub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>
pub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>
Calls C++ function: const QMetaObject* QMetaEnum::enclosingMetaObject() const
.
sourcepub unsafe fn enum_name(&self) -> *const c_char
Available on cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn enum_name(&self) -> *const c_char
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
.
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.
sourcepub unsafe fn is_flag(&self) -> bool
pub unsafe fn is_flag(&self) -> bool
Returns true
if this enumerator is used as a flag; otherwise returns false.
Calls C++ function: 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().
sourcepub unsafe fn is_scoped(&self) -> bool
pub unsafe fn is_scoped(&self) -> bool
Returns true
if this enumerator is declared as a C++11 enum class; otherwise returns false.
Calls C++ function: bool QMetaEnum::isScoped() const
.
Returns true
if this enumerator is declared as a C++11 enum class; otherwise returns false.
This function was introduced in Qt 5.8.
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
Returns true
if this enum is valid (has a name); otherwise returns false.
Calls C++ function: bool QMetaEnum::isValid() const
.
Returns true
if this enum is valid (has a name); otherwise returns false.
See also name().
sourcepub unsafe fn key(&self, index: c_int) -> *const c_char
pub unsafe fn key(&self, index: c_int) -> *const c_char
Returns the key with the given index, or 0 if no such key exists.
Calls C++ function: 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().
sourcepub unsafe fn key_count(&self) -> c_int
pub unsafe fn key_count(&self) -> c_int
Returns the number of keys.
Calls C++ function: int QMetaEnum::keyCount() const
.
Returns the number of keys.
See also key().
sourcepub unsafe fn key_to_value_2a(&self, key: *const c_char, ok: *mut bool) -> c_int
pub unsafe fn key_to_value_2a(&self, key: *const c_char, ok: *mut bool) -> c_int
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
.
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().
sourcepub unsafe fn key_to_value_1a(&self, key: *const c_char) -> c_int
pub unsafe fn key_to_value_1a(&self, key: *const c_char) -> c_int
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
.
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().
sourcepub unsafe fn keys_to_value_2a(
&self,
keys: *const c_char,
ok: *mut bool
) -> c_int
pub unsafe fn keys_to_value_2a( &self, keys: *const c_char, ok: *mut bool ) -> c_int
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
.
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().
sourcepub unsafe fn keys_to_value_1a(&self, keys: *const c_char) -> c_int
pub unsafe fn keys_to_value_1a(&self, keys: *const c_char) -> c_int
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
.
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().
sourcepub unsafe fn name(&self) -> *const c_char
pub unsafe fn name(&self) -> *const c_char
Returns the name of the enumerator (without the scope).
Calls C++ function: 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.
sourcepub unsafe fn new() -> CppBox<QMetaEnum>
pub unsafe fn new() -> CppBox<QMetaEnum>
Calls C++ function: [constructor] void QMetaEnum::QMetaEnum()
.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QMetaEnum>>
) -> CppBox<QMetaEnum>
pub unsafe fn new_copy( other: impl CastInto<Ref<QMetaEnum>> ) -> CppBox<QMetaEnum>
The QMetaEnum class provides meta-data about an enumerator.
Calls C++ function: [constructor] void QMetaEnum::QMetaEnum(const QMetaEnum& other)
.
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.
sourcepub unsafe fn scope(&self) -> *const c_char
pub unsafe fn scope(&self) -> *const c_char
Returns the scope this enumerator was declared in.
Calls C++ function: 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().
sourcepub unsafe fn value(&self, index: c_int) -> c_int
pub unsafe fn value(&self, index: c_int) -> c_int
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
.
Returns the value with the given index; or returns -1 if there is no such value.
See also keyCount(), key(), and keyToValue().
sourcepub unsafe fn value_to_key(&self, value: c_int) -> *const c_char
pub unsafe fn value_to_key(&self, value: c_int) -> *const c_char
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
.
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().
sourcepub unsafe fn value_to_keys(&self, value: c_int) -> CppBox<QByteArray>
pub unsafe fn value_to_keys(&self, value: c_int) -> CppBox<QByteArray>
Returns a byte array of '|'-separated keys that represents the given value.
Calls C++ function: QByteArray QMetaEnum::valueToKeys(int value) const
.
Returns a byte array of ‘|’-separated keys that represents the given value.
See also isFlag(), valueToKey(), and keysToValue().
Trait Implementations§
source§impl CppDeletable for QMetaEnum
impl CppDeletable for QMetaEnum
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QMetaEnum class provides meta-data about an enumerator.
Calls C++ function: [destructor] void QMetaEnum::~QMetaEnum()
.
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.