Skip to content

NativeIpcKey

Base classes

Name Children Inherits
QNativeIpcKey
PySide6.QtCore
QNativeIpcKey(self, /) -> None

⋔ Inheritance diagram

graph TD
  2199624134["core.NativeIpcKey"]
  1089534519["QtCore.QNativeIpcKey"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  1089534519 --> 2199624134
  37984305 --> 1089534519
  2751680898 --> 37984305

🛈 DocStrings

Bases: QNativeIpcKey

Holds a native key used by QSystemSemaphore and QSharedMemory.

Source code in prettyqt/core/nativeipckey.py
class NativeIpcKey(QtCore.QNativeIpcKey):
    """Holds a native key used by QSystemSemaphore and QSharedMemory."""

    def __init__(
        self,
        key: str | QtCore.QNativeIpcKey = "",
        typ: TypeStr | QtCore.QNativeIpcKey.Type | None = None,
    ):
        if isinstance(key, QtCore.QNativeIpcKey) or typ is None:
            super().__init__(key)
        else:
            super().__init__(key, TYPE.get_enum_value(typ))

    def __repr__(self):
        return get_repr(self, self.nativeKey(), self.get_type())

    def __str__(self):
        return self.toString()

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

    def set_type(self, typ: TypeStr | QtCore.QNativeIpcKey.Type):
        """Set the IPC key type.

        Args:
            typ: IPC key type to use
        """
        self.setType(TYPE.get_enum_value(typ))

    def get_type(self) -> TypeStr:
        """Return the IPC key type.

        Returns:
            IPC key type
        """
        return TYPE.inverse[self.type()]

    @classmethod
    def from_string(cls, string: str) -> Self:
        return cls(cls.fromString(string))

get_type() -> TypeStr

Return the IPC key type.

Source code in prettyqt/core/nativeipckey.py
def get_type(self) -> TypeStr:
    """Return the IPC key type.

    Returns:
        IPC key type
    """
    return TYPE.inverse[self.type()]

set_type(typ: TypeStr | QtCore.QNativeIpcKey.Type)

Set the IPC key type.

Parameters:

Name Type Description Default
typ TypeStr | Type

IPC key type to use

required
Source code in prettyqt/core/nativeipckey.py
def set_type(self, typ: TypeStr | QtCore.QNativeIpcKey.Type):
    """Set the IPC key type.

    Args:
        typ: IPC key type to use
    """
    self.setType(TYPE.get_enum_value(typ))

:fa-brands-github: Show source on GitHub