Skip to content

PythonQt.QtCore.QMetaMethod · declarations 001

Back to PythonQt.QtCore.QMetaMethod

Access instance-attribute

Access: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Attributes instance-attribute

Attributes: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Cloned instance-attribute

Cloned: Any

Compatibility instance-attribute

Compatibility: Any

Constructor instance-attribute

Constructor: Any

Method instance-attribute

Method: Any

MethodType instance-attribute

MethodType: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Private instance-attribute

Private: Any

Protected instance-attribute

Protected: Any

Public instance-attribute

Public: Any

Scriptable instance-attribute

Scriptable: Any

Signal instance-attribute

Signal: Any

Slot instance-attribute

Slot: Any

access

access() -> Any

X.access()

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

access(self) -> PySide2.QtCore.QMetaMethod.Access

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#access

attributes

attributes() -> int

X.attributes() -> int

enclosingMetaObject

enclosingMetaObject() -> Any

X.enclosingMetaObject() -> PythonQt.QtCore.QMetaObject

Upstream PySide2 reference signatures (binding differences may apply):

enclosingMetaObject(self) -> PySide2.QtCore.QMetaObject

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#enclosingMetaObject

getParameterTypes

getParameterTypes(types: Any) -> Any

X.getParameterTypes(types)

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#isValid

methodIndex

methodIndex() -> int

X.methodIndex() -> int

Supplemental documentation: Qt 5 reference:

int QMetaMethod::methodIndex() const

Returns this method's index.

This function was introduced in Qt 4.6.

Upstream PySide2 reference signatures (binding differences may apply):

methodIndex(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#methodIndex

methodSignature

methodSignature() -> Any

X.methodSignature() -> PythonQt.QtCore.QByteArray

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

methodSignature(self) -> PySide2.QtCore.QByteArray

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#methodSignature

methodType

methodType() -> Any

X.methodType()

Supplemental documentation: Qt 5 reference:

QMetaMethod::MethodType QMetaMethod::methodType() const

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

See also access().

Upstream PySide2 reference signatures (binding differences may apply):

methodType(self) -> PySide2.QtCore.QMetaMethod.MethodType

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#methodType

name

name() -> Any

X.name() -> PythonQt.QtCore.QByteArray

Supplemental documentation: Qt 5 reference:

QByteArray QMetaMethod::name() const

Returns the name of this method.

This function was introduced in Qt 5.0.

See also methodSignature() and parameterCount().

Upstream PySide2 reference signatures (binding differences may apply):

name(self) -> PySide2.QtCore.QByteArray

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#name

parameterCount

parameterCount() -> int

X.parameterCount() -> int

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

parameterCount(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#parameterCount

parameterNames

parameterNames() -> Any

X.parameterNames()

Supplemental documentation: Qt 5 reference:

QList\<QByteArray> QMetaMethod::parameterNames() const

Returns a list of parameter names.

See also parameterTypes() and methodSignature().

Upstream PySide2 reference signatures (binding differences may apply):

parameterNames(self) -> typing.List[PySide2.QtCore.QByteArray]

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#parameterNames

parameterType

parameterType(index: int) -> int

X.parameterType(index) -> int

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

parameterType(self, index: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#parameterType

parameterTypes

parameterTypes() -> Any

X.parameterTypes()

Supplemental documentation: Qt 5 reference:

QList\<QByteArray> QMetaMethod::parameterTypes() const

Returns a list of parameter types.

See also parameterNames() and methodSignature().

Upstream PySide2 reference signatures (binding differences may apply):

parameterTypes(self) -> typing.List[PySide2.QtCore.QByteArray]

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#parameterTypes

returnType

returnType() -> int

X.returnType() -> int

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

returnType(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#returnType

revision

revision() -> int

X.revision() -> int

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

revision(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#revision

tag

tag() -> str

X.tag() -> int

Supplemental documentation: Qt 5 reference:

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.

Upstream PySide2 reference signatures (binding differences may apply):

tag(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#tag

typeName

typeName() -> str

X.typeName() -> int

Supplemental documentation: Qt 5 reference:

const char *QMetaMethod::typeName() const

Returns the return type name of this method.

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

Upstream PySide2 reference signatures (binding differences may apply):

typeName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qmetamethod.html#typeName