[][src]Struct qt_core::QMetaMethod

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

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.

Methods

impl QMetaMethod[src]

pub unsafe fn access(&self) -> Access[src]

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

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

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

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

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.

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

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

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

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

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

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.

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

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.

pub unsafe fn method_signature(&self) -> CppBox<QByteArray>[src]

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

pub unsafe fn method_type(&self) -> MethodType[src]

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

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

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

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

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

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

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.

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

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

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

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

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

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.

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

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

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

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

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

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.

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

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.

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

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

impl CppDeletable for QMetaMethod[src]

unsafe fn delete(&self)[src]

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.

impl PartialEq<Ref<QMetaMethod>> for QMetaMethod[src]

fn eq(&self, m2: &Ref<QMetaMethod>) -> bool[src]

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.

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.