Skip to content

MetaMethod

⋔ Inheritance diagram

graph TD
  1473299810144["core.MetaMethod"]
  140713234304496["builtins.object"]
  140713234304496 --> 1473299810144

🛈 DocStrings

Meta-data about an member method.

Source code in prettyqt\core\metamethod.py
class MetaMethod:
    """Meta-data about an member method."""

    def __init__(self, metamethod: core.QMetaMethod):
        self.item = metamethod

    def __getattr__(self, val):
        return getattr(self.item, val)

    def __bool__(self):
        return self.item.isValid()

    def __repr__(self):
        return get_repr(self, self.get_name())

    def get_access(self) -> AccessStr:
        return ACCESS.inverse[self.item.access()]

    def get_method_type(self) -> MethodTypeStr:
        return METHOD_TYPE.inverse[self.item.methodType()]

    def get_method_signature(self) -> str:
        return self.item.methodSignature().data().decode()

    def get_normalized_method_signature(self) -> str:
        """Returns something like 'objectNameChanged(QString)'."""
        sig = self.item.methodSignature()
        normalized = core.QMetaObject.normalizedSignature(sig.data().decode())
        return normalized.data().decode()

    def get_name(self) -> str:
        return self.item.name().data().decode()

    def get_parameters(self) -> list[core.MetaType]:
        count = self.parameterCount()
        return [core.MetaType(self.parameterMetaType(i).id()) for i in range(count)]

    def get_return_type(self) -> core.MetaType:
        return core.MetaType(self.returnMetaType().id())

    def get_parameter_types(self) -> list[str]:
        """Returns sth. like ['QString']."""
        return [i.data().decode() for i in self.parameterTypes()]

get_normalized_method_signature() -> str

Returns something like 'objectNameChanged(QString)'.

Source code in prettyqt\core\metamethod.py
def get_normalized_method_signature(self) -> str:
    """Returns something like 'objectNameChanged(QString)'."""
    sig = self.item.methodSignature()
    normalized = core.QMetaObject.normalizedSignature(sig.data().decode())
    return normalized.data().decode()

get_parameter_types() -> list[str]

Returns sth. like ['QString'].

Source code in prettyqt\core\metamethod.py
def get_parameter_types(self) -> list[str]:
    """Returns sth. like ['QString']."""
    return [i.data().decode() for i in self.parameterTypes()]