Skip to content

LocalSocket

Qt Base Class: QLocalSocket

Signature: QLocalSocket(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
IODeviceMixin
prettyqt.core.iodevice
QLocalSocket
PySide6.QtNetwork
QLocalSocket(self, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473574003664["network.LocalSocket"]
  1473299871632["core.IODeviceMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473573799680["QtNetwork.QLocalSocket"]
  1473288885184["QtCore.QIODevice"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473243629040["QtCore.QIODeviceBase"]
  1473299871632 --> 1473574003664
  1473299815024 --> 1473299871632
  140713234304496 --> 1473299815024
  1473573799680 --> 1473574003664
  1473288885184 --> 1473573799680
  1473288842240 --> 1473288885184
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208
  1473243629040 --> 1473288885184
  1473291690208 --> 1473243629040

🛈 DocStrings

Bases: IODeviceMixin, QLocalSocket

Local socket.

Source code in prettyqt\network\localsocket.py
class LocalSocket(core.IODeviceMixin, QtNetwork.QLocalSocket):
    """Local socket."""

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

    def get_error(self) -> LocalSocketErrorStr:
        return LOCAL_SOCKET_ERROR.inverse[self.error()]

    def get_state(self) -> LocalSocketStateStr:
        return LOCAL_SOCKET_STATE.inverse[self.state()]

    def connect_to_server(
        self,
        server_name: str | None = None,
        mode: core.iodevice.OpenModeStr | core.QIODevice.OpenModeFlag = "read_write",
    ):
        open_mode = core.iodevice.OPEN_MODES.get_enum_value(mode)
        if server_name is not None:
            self.connectToServer(server_name, open_mode)
        else:
            self.connectToServer(open_mode)

⌗ Property table

Qt Property Type Doc
objectName QString
socketOptions QFlags