Table Of Contents

Previous topic

QGenericArgument

Next topic

QMetaObject

QMetaMethod

Synopsis

Functions

  • def access ()
  • def enclosingMetaObject ()
  • def invoke (object, connectionType, returnValue[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
  • def invoke (object, connectionType[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
  • def invoke (object, returnValue[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
  • def invoke (object[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
  • def methodIndex ()
  • def methodType ()
  • def parameterNames ()
  • def parameterTypes ()
  • def revision ()
  • def signature ()
  • def tag ()
  • def typeName ()

Detailed Description

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

A PySide.QtCore.QMetaMethod has a PySide.QtCore.QMetaMethod.methodType() , a PySide.QtCore.QMetaMethod.signature() , a list of PySide.QtCore.QMetaMethod.parameterTypes() and PySide.QtCore.QMetaMethod.parameterNames() , a return PySide.QtCore.QMetaMethod.typeName() , a PySide.QtCore.QMetaMethod.tag() , and an PySide.QtCore.QMetaMethod.access() specifier. You can use PySide.QtCore.QMetaMethod.invoke() to invoke the method on an arbitrary PySide.QtCore.QObject .

A method will only be registered with the meta-object system if it is a slot, a signal, or declared with the Q_INVOKABLE() macro. Constructors can also be registered with Q_INVOKABLE() .

class PySide.QtCore.QMetaMethod
class PySide.QtCore.QMetaMethod(QMetaMethod)
Parameters:QMetaMethodPySide.QtCore.QMetaMethod
PySide.QtCore.QMetaMethod.Access

This enum describes the access level of a method, following the conventions used in C++.

Constant Description
QMetaMethod.Private  
QMetaMethod.Protected  
QMetaMethod.Public  
PySide.QtCore.QMetaMethod.MethodType
Constant Description
QMetaMethod.Method The function is a plain member function.
QMetaMethod.Signal The function is a signal.
QMetaMethod.Slot The function is a slot.
QMetaMethod.Constructor The function is a constructor.
PySide.QtCore.QMetaMethod.access()
Return type:PySide.QtCore.QMetaMethod.Access

Returns the access specification of this method (private, protected, or public).

Signals are always protected, meaning that you can only emit them from the class or from a subclass.

PySide.QtCore.QMetaMethod.enclosingMetaObject()
Return type:PySide.QtCore.QMetaObject
PySide.QtCore.QMetaMethod.invoke(object, connectionType[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
Parameters:
Return type:

PySide.QtCore.bool

PySide.QtCore.QMetaMethod.invoke(object, connectionType, returnValue[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
Parameters:
Return type:

PySide.QtCore.bool

PySide.QtCore.QMetaMethod.invoke(object, returnValue[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
Parameters:
Return type:

PySide.QtCore.bool

This function overloads PySide.QtCore.QMetaMethod.invoke() .

This overload always invokes this method using the connection type Qt.AutoConnection .

PySide.QtCore.QMetaMethod.invoke(object[, val0=QGenericArgument(0)[, val1=QGenericArgument()[, val2=QGenericArgument()[, val3=QGenericArgument()[, val4=QGenericArgument()[, val5=QGenericArgument()[, val6=QGenericArgument()[, val7=QGenericArgument()[, val8=QGenericArgument()[, val9=QGenericArgument()]]]]]]]]]])
Parameters:
Return type:

PySide.QtCore.bool

This function overloads PySide.QtCore.QMetaMethod.invoke() .

This overload invokes this method using the connection type Qt.AutoConnection and ignores return values.

PySide.QtCore.QMetaMethod.methodIndex()
Return type:PySide.QtCore.int

Returns this method’s index.

PySide.QtCore.QMetaMethod.methodType()
Return type:PySide.QtCore.QMetaMethod.MethodType

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

PySide.QtCore.QMetaMethod.parameterNames()
Return type:

Returns a list of parameter names.

PySide.QtCore.QMetaMethod.parameterTypes()
Return type:

Returns a list of parameter types.

PySide.QtCore.QMetaMethod.revision()
Return type:PySide.QtCore.int

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

PySide.QtCore.QMetaMethod.signature()
Return type:str

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

PySide.QtCore.QMetaMethod.tag()
Return type:str

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:

#define THISISTESTTAG // tag text
...
private slots:
    THISISTESTTAG void testFunc();

and the information can be accessed by using:

MainWindow win;
win.show();

int functionIndex = win.metaObject()->indexOfSlot("testFunc()");
QMetaMethod mm = metaObject()->method(functionIndex);
qDebug() << mm.tag(); // prints THISISTESTTAG

For the moment, moc doesn’t support any special tags.

PySide.QtCore.QMetaMethod.typeName()
Return type:str

Returns the return type of this method, or an empty string if the return type is void .