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.

C++ documentation:

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

source

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.

C++ documentation:

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

source

pub unsafe fn attributes(&self) -> c_int

Calls C++ function: int QMetaMethod::attributes() const.

source

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

C++ documentation:

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

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

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

source

pub unsafe fn get_parameter_types(&self, types: *mut c_int)

Calls C++ function: void QMetaMethod::getParameterTypes(int* types) const.

source

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.

C++ documentation:

Returns true if this method is valid (can be introspected and invoked), otherwise returns false.

This function was introduced in Qt 5.0.

source

pub unsafe fn method_index(&self) -> c_int

Returns this method's index.

Calls C++ function: int QMetaMethod::methodIndex() const.

C++ documentation:

Returns this method’s index.

This function was introduced in Qt 4.6.

source

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.

C++ documentation:

Returns the signature of this method (e.g., setValue(double)).

This function was introduced in Qt 5.0.

See also parameterTypes() and parameterNames().

source

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.

C++ documentation:

Returns the type of this method (signal, slot, or method).

See also access().

source

pub unsafe fn name(&self) -> CppBox<QByteArray>

Returns the name of this method.

Calls C++ function: QByteArray QMetaMethod::name() const.

C++ documentation:

Returns the name of this method.

This function was introduced in Qt 5.0.

See also methodSignature() and parameterCount().

source

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

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

source

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

C++ documentation:

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

pub unsafe fn parameter_count(&self) -> c_int

Returns the number of parameters of this method.

Calls C++ function: int QMetaMethod::parameterCount() const.

C++ documentation:

Returns the number of parameters of this method.

This function was introduced in Qt 5.0.

See also parameterType() and parameterNames().

source

pub unsafe fn parameter_names(&self) -> CppBox<QListOfQByteArray>

Returns a list of parameter names.

Calls C++ function: QList<QByteArray> QMetaMethod::parameterNames() const.

C++ documentation:

Returns a list of parameter names.

See also parameterTypes() and methodSignature().

source

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.

C++ documentation:

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.

source

pub unsafe fn parameter_types(&self) -> CppBox<QListOfQByteArray>

Returns a list of parameter types.

Calls C++ function: QList<QByteArray> QMetaMethod::parameterTypes() const.

C++ documentation:

Returns a list of parameter types.

See also parameterNames() and methodSignature().

source

pub unsafe fn return_type(&self) -> c_int

Returns the return type of this method.

Calls C++ function: int QMetaMethod::returnType() const.

C++ documentation:

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

source

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.

C++ documentation:

Returns the method revision if one was specified by Q_REVISION, otherwise returns 0.

This function was introduced in Qt 5.1.

source

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

Returns the tag associated with this method.

Calls C++ function: const char* QMetaMethod::tag() const.

C++ documentation:

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.

source

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.

C++ documentation:

Returns the return type name of this method.

See also returnType() and QMetaType::type().

Trait Implementations§

source§

impl CppDeletable for QMetaMethod

source§

unsafe fn delete(&self)

The QMetaMethod class provides meta-data about a member function.

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

C++ documentation:

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

source§

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.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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.