Struct qt_core::QMetaObject

source ·
#[repr(C)]
pub struct QMetaObject { /* private fields */ }
Expand description

The QMetaObject class contains meta-information about Qt objects.

C++ class: QMetaObject.

C++ documentation:

The QMetaObject class contains meta-information about Qt objects.

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

Implementations§

source§

impl QMetaObject

source

pub unsafe fn activate_q_object_int_void( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, argv: *mut *mut c_void )

Calls C++ function: static void QMetaObject::activate(QObject* sender, int signal_index, void** argv).

source

pub unsafe fn activate_q_object_q_meta_object_int_void( sender: impl CastInto<Ptr<QObject>>, arg2: impl CastInto<Ptr<QMetaObject>>, local_signal_index: c_int, argv: *mut *mut c_void )

Calls C++ function: static void QMetaObject::activate(QObject* sender, const QMetaObject* arg2, int local_signal_index, void** argv).

source

pub unsafe fn activate_q_object2_int_void( sender: impl CastInto<Ptr<QObject>>, signal_offset: c_int, local_signal_index: c_int, argv: *mut *mut c_void )

Calls C++ function: static void QMetaObject::activate(QObject* sender, int signal_offset, int local_signal_index, void** argv).

source

pub unsafe fn cast_q_object( &self, obj: impl CastInto<Ptr<QObject>> ) -> QPtr<QObject>

Calls C++ function: QObject* QMetaObject::cast(QObject* obj) const.

source

pub unsafe fn cast_q_object2( &self, obj: impl CastInto<Ptr<QObject>> ) -> QPtr<QObject>

Calls C++ function: const QObject* QMetaObject::cast(const QObject* obj) const.

source

pub unsafe fn check_connect_args_2_char( signal: *const c_char, method: *const c_char ) -> bool

Returns true if the signal and method arguments are compatible; otherwise returns false.

Calls C++ function: static bool QMetaObject::checkConnectArgs(const char* signal, const char* method).

C++ documentation:

Returns true if the signal and method arguments are compatible; otherwise returns false.

Both signal and method are expected to be normalized.

See also normalizedSignature().

source

pub unsafe fn check_connect_args_2_q_meta_method( signal: impl CastInto<Ref<QMetaMethod>>, method: impl CastInto<Ref<QMetaMethod>> ) -> bool

This is an overloaded function.

Calls C++ function: static bool QMetaObject::checkConnectArgs(const QMetaMethod& signal, const QMetaMethod& method).

C++ documentation:

This is an overloaded function.

Returns true if the signal and method arguments are compatible; otherwise returns false.

This function was introduced in Qt 5.0.

source

pub unsafe fn class_info(&self, index: c_int) -> CppBox<QMetaClassInfo>

Returns the meta-data for the item of class information with the given index.

Calls C++ function: QMetaClassInfo QMetaObject::classInfo(int index) const.

C++ documentation:

Returns the meta-data for the item of class information with the given index.

Example:

class MyClass : public QObject { Q_OBJECT Q_CLASSINFO(“author”, “Sabrina Schweinsteiger”) Q_CLASSINFO(“url”, “http://doc.moosesoft.co.uk/1.0/”)

public: ... };

See also classInfoCount(), classInfoOffset(), and indexOfClassInfo().

source

pub unsafe fn class_info_count(&self) -> c_int

Returns the number of items of class information in this class.

Calls C++ function: int QMetaObject::classInfoCount() const.

C++ documentation:

Returns the number of items of class information in this class.

See also classInfo(), classInfoOffset(), and indexOfClassInfo().

source

pub unsafe fn class_info_offset(&self) -> c_int

Returns the class information offset for this class; i.e. the index position of this class's first class information item.

Calls C++ function: int QMetaObject::classInfoOffset() const.

C++ documentation:

Returns the class information offset for this class; i.e. the index position of this class’s first class information item.

If the class has no superclasses with class information, the offset is 0; otherwise the offset is the sum of all the class information items in the class's superclasses.

See also classInfo(), classInfoCount(), and indexOfClassInfo().

source

pub unsafe fn class_name(&self) -> *const c_char

Returns the class name.

Calls C++ function: const char* QMetaObject::className() const.

C++ documentation:

Returns the class name.

See also superClass().

source

pub unsafe fn connect_6a( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, receiver: impl CastInto<Ptr<QObject>>, method_index: c_int, type_: c_int, types: *mut c_int ) -> CppBox<Connection>

Calls C++ function: static QMetaObject::Connection QMetaObject::connect(const QObject* sender, int signal_index, const QObject* receiver, int method_index, int type = …, int* types = …).

source

pub unsafe fn connect_5a( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, receiver: impl CastInto<Ptr<QObject>>, method_index: c_int, type_: c_int ) -> CppBox<Connection>

Calls C++ function: static QMetaObject::Connection QMetaObject::connect(const QObject* sender, int signal_index, const QObject* receiver, int method_index, int type = …).

source

pub unsafe fn connect_4a( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, receiver: impl CastInto<Ptr<QObject>>, method_index: c_int ) -> CppBox<Connection>

Calls C++ function: static QMetaObject::Connection QMetaObject::connect(const QObject* sender, int signal_index, const QObject* receiver, int method_index).

source

pub unsafe fn connect_slots_by_name(o: impl CastInto<Ptr<QObject>>)

Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:

Calls C++ function: static void QMetaObject::connectSlotsByName(QObject* o).

C++ documentation:

Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:


  void on_<object name>_<signal name>(<signal parameters>);

Let's assume our object has a child object of type QPushButton with the object name button1. The slot to catch the button's clicked() signal would be:

void on_button1_clicked();

If object itself has a properly set object name, its own signals are also connected to its respective slots.

See also QObject::setObjectName().

source

pub unsafe fn constructor(&self, index: c_int) -> CppBox<QMetaMethod>

Returns the meta-data for the constructor with the given index.

Calls C++ function: QMetaMethod QMetaObject::constructor(int index) const.

C++ documentation:

Returns the meta-data for the constructor with the given index.

This function was introduced in Qt 4.5.

See also constructorCount() and newInstance().

source

pub unsafe fn constructor_count(&self) -> c_int

Returns the number of constructors in this class.

Calls C++ function: int QMetaObject::constructorCount() const.

C++ documentation:

Returns the number of constructors in this class.

This function was introduced in Qt 4.5.

See also constructor() and indexOfConstructor().

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QMetaObject>> ) -> Ref<QMetaObject>

The QMetaObject class contains meta-information about Qt objects.

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

C++ documentation:

The QMetaObject class contains meta-information about Qt objects.

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

source

pub unsafe fn disconnect( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, receiver: impl CastInto<Ptr<QObject>>, method_index: c_int ) -> bool

Calls C++ function: static bool QMetaObject::disconnect(const QObject* sender, int signal_index, const QObject* receiver, int method_index).

source

pub unsafe fn disconnect_one( sender: impl CastInto<Ptr<QObject>>, signal_index: c_int, receiver: impl CastInto<Ptr<QObject>>, method_index: c_int ) -> bool

Calls C++ function: static bool QMetaObject::disconnectOne(const QObject* sender, int signal_index, const QObject* receiver, int method_index).

source

pub unsafe fn enumerator(&self, index: c_int) -> CppBox<QMetaEnum>

Returns the meta-data for the enumerator with the given index.

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

C++ documentation:

Returns the meta-data for the enumerator with the given index.

See also enumeratorCount(), enumeratorOffset(), and indexOfEnumerator().

source

pub unsafe fn enumerator_count(&self) -> c_int

Returns the number of enumerators in this class.

Calls C++ function: int QMetaObject::enumeratorCount() const.

C++ documentation:

Returns the number of enumerators in this class.

See also enumerator(), enumeratorOffset(), and indexOfEnumerator().

source

pub unsafe fn enumerator_offset(&self) -> c_int

Returns the enumerator offset for this class; i.e. the index position of this class's first enumerator.

Calls C++ function: int QMetaObject::enumeratorOffset() const.

C++ documentation:

Returns the enumerator offset for this class; i.e. the index position of this class’s first enumerator.

If the class has no superclasses with enumerators, the offset is 0; otherwise the offset is the sum of all the enumerators in the class's superclasses.

See also enumerator(), enumeratorCount(), and indexOfEnumerator().

source

pub unsafe fn index_of_class_info(&self, name: *const c_char) -> c_int

Finds class information item name and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfClassInfo(const char* name) const.

C++ documentation:

Finds class information item name and returns its index; otherwise returns -1.

See also classInfo(), classInfoCount(), and classInfoOffset().

source

pub unsafe fn index_of_constructor(&self, constructor: *const c_char) -> c_int

Finds constructor and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfConstructor(const char* constructor) const.

C++ documentation:

Finds constructor and returns its index; otherwise returns -1.

Note that the constructor has to be in normalized form, as returned by normalizedSignature().

This function was introduced in Qt 4.5.

See also constructor(), constructorCount(), and normalizedSignature().

source

pub unsafe fn index_of_enumerator(&self, name: *const c_char) -> c_int

Finds enumerator name and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfEnumerator(const char* name) const.

C++ documentation:

Finds enumerator name and returns its index; otherwise returns -1.

See also enumerator(), enumeratorCount(), and enumeratorOffset().

source

pub unsafe fn index_of_method(&self, method: *const c_char) -> c_int

Finds method and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfMethod(const char* method) const.

C++ documentation:

Finds method and returns its index; otherwise returns -1.

Note that the method has to be in normalized form, as returned by normalizedSignature().

See also method(), methodCount(), methodOffset(), and normalizedSignature().

source

pub unsafe fn index_of_property(&self, name: *const c_char) -> c_int

Finds property name and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfProperty(const char* name) const.

C++ documentation:

Finds property name and returns its index; otherwise returns -1.

See also property(), propertyCount(), and propertyOffset().

source

pub unsafe fn index_of_signal(&self, signal: *const c_char) -> c_int

Finds signal and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfSignal(const char* signal) const.

C++ documentation:

Finds signal and returns its index; otherwise returns -1.

This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a signal.

Note that the signal has to be in normalized form, as returned by normalizedSignature().

See also indexOfMethod(), normalizedSignature(), method(), methodCount(), and methodOffset().

source

pub unsafe fn index_of_slot(&self, slot: *const c_char) -> c_int

Finds slot and returns its index; otherwise returns -1.

Calls C++ function: int QMetaObject::indexOfSlot(const char* slot) const.

C++ documentation:

Finds slot and returns its index; otherwise returns -1.

This is the same as indexOfMethod(), except that it will return -1 if the method exists but isn't a slot.

See also indexOfMethod(), method(), methodCount(), and methodOffset().

source

pub unsafe fn inherits( &self, meta_object: impl CastInto<Ptr<QMetaObject>> ) -> bool

Returns true if the class described by this QMetaObject inherits the type described by metaObject; otherwise returns false.

Calls C++ function: bool QMetaObject::inherits(const QMetaObject* metaObject) const.

C++ documentation:

Returns true if the class described by this QMetaObject inherits the type described by metaObject; otherwise returns false.

A type is considered to inherit itself.

This function was introduced in Qt 5.7.

source

pub unsafe fn metacall( arg1: impl CastInto<Ptr<QObject>>, arg2: Call, arg3: c_int, arg4: *mut *mut c_void ) -> c_int

Calls C++ function: static int QMetaObject::metacall(QObject* arg1, QMetaObject::Call arg2, int arg3, void** arg4).

source

pub unsafe fn method(&self, index: c_int) -> CppBox<QMetaMethod>

Returns the meta-data for the method with the given index.

Calls C++ function: QMetaMethod QMetaObject::method(int index) const.

C++ documentation:

Returns the meta-data for the method with the given index.

See also methodCount(), methodOffset(), and indexOfMethod().

source

pub unsafe fn method_count(&self) -> c_int

Returns the number of methods in this class, including the number of methods provided by each base class. These include signals and slots as well as normal member functions.

Calls C++ function: int QMetaObject::methodCount() const.

C++ documentation:

Returns the number of methods in this class, including the number of methods provided by each base class. These include signals and slots as well as normal member functions.

Use code like the following to obtain a QStringList containing the methods specific to a given class:

const QMetaObject* metaObject = obj->metaObject(); QStringList methods; for(int i = metaObject->methodOffset(); i < metaObject->methodCount(); ++i) methods << QString::fromLatin1(metaObject->method(i).methodSignature());

See also method(), methodOffset(), and indexOfMethod().

source

pub unsafe fn method_offset(&self) -> c_int

Returns the method offset for this class; i.e. the index position of this class's first member function.

Calls C++ function: int QMetaObject::methodOffset() const.

C++ documentation:

Returns the method offset for this class; i.e. the index position of this class’s first member function.

The offset is the sum of all the methods in the class's superclasses (which is always positive since QObject has the deleteLater() slot and a destroyed() signal).

See also method(), methodCount(), and indexOfMethod().

source

pub unsafe fn new() -> CppBox<QMetaObject>

The QMetaObject class contains meta-information about Qt objects.

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

C++ documentation:

The QMetaObject class contains meta-information about Qt objects.

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QMetaObject>> ) -> CppBox<QMetaObject>

The QMetaObject class contains meta-information about Qt objects.

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

C++ documentation:

The QMetaObject class contains meta-information about Qt objects.

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

source

pub unsafe fn normalized_signature(method: *const c_char) -> CppBox<QByteArray>

Normalizes the signature of the given method.

Calls C++ function: static QByteArray QMetaObject::normalizedSignature(const char* method).

C++ documentation:

Normalizes the signature of the given method.

Qt uses normalized signatures to decide whether two given signals and slots are compatible. Normalization reduces whitespace to a minimum, moves 'const' to the front where appropriate, removes 'const' from value types and replaces const references with values.

See also checkConnectArgs() and normalizedType().

source

pub unsafe fn normalized_type(type_: *const c_char) -> CppBox<QByteArray>

Normalizes a type.

Calls C++ function: static QByteArray QMetaObject::normalizedType(const char* type).

C++ documentation:

Normalizes a type.

See QMetaObject::normalizedSignature() for a description on how Qt normalizes.

Example:

QByteArray normType = QMetaObject::normalizedType(“ int const ); // normType is now “const int

This function was introduced in Qt 4.2.

See also normalizedSignature().

source

pub unsafe fn property(&self, index: c_int) -> CppBox<QMetaProperty>

Returns the meta-data for the property with the given index. If no such property exists, a null QMetaProperty is returned.

Calls C++ function: QMetaProperty QMetaObject::property(int index) const.

C++ documentation:

Returns the meta-data for the property with the given index. If no such property exists, a null QMetaProperty is returned.

See also propertyCount(), propertyOffset(), and indexOfProperty().

source

pub unsafe fn property_count(&self) -> c_int

Returns the number of properties in this class, including the number of properties provided by each base class.

Calls C++ function: int QMetaObject::propertyCount() const.

C++ documentation:

Returns the number of properties in this class, including the number of properties provided by each base class.

Use code like the following to obtain a QStringList containing the properties specific to a given class:

const QMetaObject* metaObject = obj->metaObject(); QStringList properties; for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i) properties << QString::fromLatin1(metaObject->property(i).name());

See also property(), propertyOffset(), and indexOfProperty().

source

pub unsafe fn property_offset(&self) -> c_int

Returns the property offset for this class; i.e. the index position of this class's first property.

Calls C++ function: int QMetaObject::propertyOffset() const.

C++ documentation:

Returns the property offset for this class; i.e. the index position of this class’s first property.

The offset is the sum of all the properties in the class's superclasses (which is always positive since QObject has the name() property).

See also property(), propertyCount(), and indexOfProperty().

source

pub unsafe fn static_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int

Calls C++ function: int QMetaObject::static_metacall(QMetaObject::Call arg1, int arg2, void** arg3) const.

source

pub unsafe fn super_class(&self) -> Ptr<QMetaObject>

Returns the meta-object of the superclass, or 0 if there is no such object.

Calls C++ function: const QMetaObject* QMetaObject::superClass() const.

C++ documentation:

Returns the meta-object of the superclass, or 0 if there is no such object.

See also className().

source

pub unsafe fn tr_3a( &self, s: *const c_char, c: *const c_char, n: c_int ) -> CppBox<QString>

Calls C++ function: QString QMetaObject::tr(const char* s, const char* c, int n = …) const.

source

pub unsafe fn tr_2a( &self, s: *const c_char, c: *const c_char ) -> CppBox<QString>

Calls C++ function: QString QMetaObject::tr(const char* s, const char* c) const.

source

pub unsafe fn user_property(&self) -> CppBox<QMetaProperty>

Returns the property that has the USER flag set to true.

Calls C++ function: QMetaProperty QMetaObject::userProperty() const.

C++ documentation:

Returns the property that has the USER flag set to true.

This function was introduced in Qt 4.2.

See also QMetaProperty::isUser().

Trait Implementations§

source§

impl CppDeletable for QMetaObject

source§

unsafe fn delete(&self)

The QMetaObject class contains meta-information about Qt objects.

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

C++ documentation:

The QMetaObject class contains meta-information about Qt objects.

The Qt Meta-Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information, and the Qt property system. A single QMetaObject instance is created for each QObject subclass that is used in an application, and this instance stores all the meta-information for the QObject subclass. This object is available as QObject::metaObject().

This class is not normally required for application programming, but it is useful if you write meta-applications, such as scripting engines or GUI builders.

The functions you are most likely to find useful are these:

The index functions indexOfConstructor(), indexOfMethod(), indexOfEnumerator(), and indexOfProperty() map names of constructors, member functions, enumerators, or properties to indexes in the meta-object. For example, Qt uses indexOfMethod() internally when you connect a signal to a slot.

Classes can also have a list of name--value pairs of additional class information, stored in QMetaClassInfo objects. The number of pairs is returned by classInfoCount(), single pairs are returned by classInfo(), and you can search for pairs with indexOfClassInfo().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.