Struct qt_core::QMetaMethod
source · #[repr(C)]pub struct QMetaMethod { /* private fields */ }
Expand description
The QMetaMethod class provides meta-data about a member function.
C++ class: QMetaMethod
.
The QMetaMethod class provides meta-data about a member function.
A QMetaMethod has a methodType(), a methodSignature(), a list of parameterTypes() and parameterNames(), a return typeName(), a tag(), and an access() specifier. You can use invoke() to invoke the method on an arbitrary QObject.
Implementations§
source§impl QMetaMethod
impl QMetaMethod
sourcepub unsafe fn access(&self) -> Access
pub unsafe fn access(&self) -> Access
Returns the access specification of this method (private, protected, or public).
Calls C++ function: QMetaMethod::Access QMetaMethod::access() const
.
Returns the access specification of this method (private, protected, or public).
Note: Signals are always public, but you should regard that as an implementation detail. It is almost always a bad idea to emit a signal from outside its class.
See also methodType().
sourcepub unsafe fn attributes(&self) -> c_int
pub unsafe fn attributes(&self) -> c_int
Calls C++ function: int QMetaMethod::attributes() const
.
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QMetaMethod>>
) -> Ref<QMetaMethod>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QMetaMethod>> ) -> Ref<QMetaMethod>
The QMetaMethod class provides meta-data about a member function.
Calls C++ function: QMetaMethod& QMetaMethod::operator=(const QMetaMethod& other)
.
The QMetaMethod class provides meta-data about a member function.
A QMetaMethod has a methodType(), a methodSignature(), a list of parameterTypes() and parameterNames(), a return typeName(), a tag(), and an access() specifier. You can use invoke() to invoke the method on an arbitrary QObject.
sourcepub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>
pub unsafe fn enclosing_meta_object(&self) -> Ptr<QMetaObject>
Calls C++ function: const QMetaObject* QMetaMethod::enclosingMetaObject() const
.
sourcepub unsafe fn get_parameter_types(&self, types: *mut c_int)
pub unsafe fn get_parameter_types(&self, types: *mut c_int)
Calls C++ function: void QMetaMethod::getParameterTypes(int* types) const
.
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
Returns true
if this method is valid (can be introspected and invoked), otherwise returns false
.
Calls C++ function: bool QMetaMethod::isValid() const
.
Returns true
if this method is valid (can be introspected and invoked), otherwise returns false
.
This function was introduced in Qt 5.0.
sourcepub unsafe fn method_index(&self) -> c_int
pub unsafe fn method_index(&self) -> c_int
Returns this method's index.
Calls C++ function: int QMetaMethod::methodIndex() const
.
Returns this method’s index.
This function was introduced in Qt 4.6.
sourcepub unsafe fn method_signature(&self) -> CppBox<QByteArray>
pub unsafe fn method_signature(&self) -> CppBox<QByteArray>
Returns the signature of this method (e.g., setValue(double)
).
Calls C++ function: QByteArray QMetaMethod::methodSignature() const
.
Returns the signature of this method (e.g., setValue(double)
).
This function was introduced in Qt 5.0.
See also parameterTypes() and parameterNames().
sourcepub unsafe fn method_type(&self) -> MethodType
pub unsafe fn method_type(&self) -> MethodType
Returns the type of this method (signal, slot, or method).
Calls C++ function: QMetaMethod::MethodType QMetaMethod::methodType() const
.
Returns the type of this method (signal, slot, or method).
See also access().
sourcepub unsafe fn name(&self) -> CppBox<QByteArray>
pub unsafe fn name(&self) -> CppBox<QByteArray>
Returns the name of this method.
Calls C++ function: QByteArray QMetaMethod::name() const
.
Returns the name of this method.
This function was introduced in Qt 5.0.
See also methodSignature() and parameterCount().
sourcepub unsafe fn new() -> CppBox<QMetaMethod>
pub unsafe fn new() -> CppBox<QMetaMethod>
Calls C++ function: [constructor] void QMetaMethod::QMetaMethod()
.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QMetaMethod>>
) -> CppBox<QMetaMethod>
pub unsafe fn new_copy( other: impl CastInto<Ref<QMetaMethod>> ) -> CppBox<QMetaMethod>
The QMetaMethod class provides meta-data about a member function.
Calls C++ function: [constructor] void QMetaMethod::QMetaMethod(const QMetaMethod& other)
.
The QMetaMethod class provides meta-data about a member function.
A QMetaMethod has a methodType(), a methodSignature(), a list of parameterTypes() and parameterNames(), a return typeName(), a tag(), and an access() specifier. You can use invoke() to invoke the method on an arbitrary QObject.
sourcepub unsafe fn parameter_count(&self) -> c_int
pub unsafe fn parameter_count(&self) -> c_int
Returns the number of parameters of this method.
Calls C++ function: int QMetaMethod::parameterCount() const
.
Returns the number of parameters of this method.
This function was introduced in Qt 5.0.
See also parameterType() and parameterNames().
sourcepub unsafe fn parameter_names(&self) -> CppBox<QListOfQByteArray>
pub unsafe fn parameter_names(&self) -> CppBox<QListOfQByteArray>
Returns a list of parameter names.
Calls C++ function: QList<QByteArray> QMetaMethod::parameterNames() const
.
Returns a list of parameter names.
See also parameterTypes() and methodSignature().
sourcepub unsafe fn parameter_type(&self, index: c_int) -> c_int
pub unsafe fn parameter_type(&self, index: c_int) -> c_int
Returns the type of the parameter at the given index.
Calls C++ function: int QMetaMethod::parameterType(int index) const
.
Returns the type of the parameter at the given index.
The return value is one of the types that are registered with QMetaType, or QMetaType::UnknownType if the type is not registered.
This function was introduced in Qt 5.0.
See also parameterCount(), returnType(), and QMetaType.
sourcepub unsafe fn parameter_types(&self) -> CppBox<QListOfQByteArray>
pub unsafe fn parameter_types(&self) -> CppBox<QListOfQByteArray>
Returns a list of parameter types.
Calls C++ function: QList<QByteArray> QMetaMethod::parameterTypes() const
.
Returns a list of parameter types.
See also parameterNames() and methodSignature().
sourcepub unsafe fn return_type(&self) -> c_int
pub unsafe fn return_type(&self) -> c_int
Returns the return type of this method.
Calls C++ function: int QMetaMethod::returnType() const
.
Returns the return type of this method.
The return value is one of the types that are registered with QMetaType, or QMetaType::UnknownType if the type is not registered.
This function was introduced in Qt 5.0.
See also parameterType(), QMetaType, and typeName().
sourcepub unsafe fn revision(&self) -> c_int
pub unsafe fn revision(&self) -> c_int
Returns the method revision if one was specified by Q_REVISION, otherwise returns 0.
Calls C++ function: int QMetaMethod::revision() const
.
Returns the method revision if one was specified by Q_REVISION, otherwise returns 0.
This function was introduced in Qt 5.1.
sourcepub unsafe fn tag(&self) -> *const c_char
pub unsafe fn tag(&self) -> *const c_char
Returns the tag associated with this method.
Calls C++ function: const char* QMetaMethod::tag() const
.
Returns the tag associated with this method.
Tags are special macros recognized by moc
that make it possible to add extra information about a method.
Tag information can be added in the following way in the function declaration:
// In the class MainWindow declaration #ifndef Q_MOC_RUN // define the tag text as empty, so the compiler doesn’t see it # define MY_CUSTOM_TAG #endif ... private slots: MY_CUSTOM_TAG void testFunc();
and the information can be accessed by using:
MainWindow win; win.show();
int functionIndex = win.metaObject()->indexOfSlot(“testFunc()”); QMetaMethod mm = win.metaObject()->method(functionIndex); qDebug() << mm.tag(); // prints MY_CUSTOM_TAG
For the moment, moc
will extract and record all tags, but it will not handle any of them specially. You can use the tags to annotate your methods differently, and treat them according to the specific needs of your application.
Note: Since Qt 5.0, moc
expands preprocessor macros, so it is necessary to surround the definition with #ifndef
Q_MOC_RUN
, as shown in the example above. This was not required in Qt 4. The code as shown above works with Qt 4 too.
sourcepub unsafe fn type_name(&self) -> *const c_char
pub unsafe fn type_name(&self) -> *const c_char
Returns the return type name of this method.
Calls C++ function: const char* QMetaMethod::typeName() const
.
Returns the return type name of this method.
See also returnType() and QMetaType::type().
Trait Implementations§
source§impl CppDeletable for QMetaMethod
impl CppDeletable for QMetaMethod
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QMetaMethod class provides meta-data about a member function.
Calls C++ function: [destructor] void QMetaMethod::~QMetaMethod()
.
The QMetaMethod class provides meta-data about a member function.
A QMetaMethod has a methodType(), a methodSignature(), a list of parameterTypes() and parameterNames(), a return typeName(), a tag(), and an access() specifier. You can use invoke() to invoke the method on an arbitrary QObject.
source§impl PartialEq<Ref<QMetaMethod>> for QMetaMethod
impl PartialEq<Ref<QMetaMethod>> for QMetaMethod
source§fn eq(&self, m2: &Ref<QMetaMethod>) -> bool
fn eq(&self, m2: &Ref<QMetaMethod>) -> bool
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(const QMetaMethod& m1, const QMetaMethod& m2)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.