Skip to content

HostAddress

Qt Base Class: QHostAddress

Signature: QHostAddress(self) -> None QHostAddress(self, address: PySide6.QtNetwork.QHostAddress.SpecialAddress) -> None QHostAddress(self, address: str) -> None QHostAddress(self, copy: Union[PySide6.QtNetwork.QHostAddress, PySide6.QtNetwork.QHostAddress.SpecialAddress]) -> None QHostAddress(self, ip4Addr: int) -> None QHostAddress(self, ip6Addr: PySide6.QtNetwork.QIPv6Address) -> None

Base classes

Name Children Inherits
QHostAddress
PySide6.QtNetwork
QHostAddress(self) -> None

⋔ Inheritance diagram

graph TD
  1473574002688["network.HostAddress"]
  1473573829936["QtNetwork.QHostAddress"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473573829936 --> 1473574002688
  1473291690208 --> 1473573829936
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QHostAddress

IP address.

Source code in prettyqt\network\hostaddress.py
class HostAddress(network.QHostAddress):
    """IP address."""

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

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

    def __bool__(self):
        return not self.isNull()

    def get_protocol(self) -> NetworkLayerProtocolStr:
        return network.abstractsocket.NETWORK_LAYER_PROTOCOL.inverse[self.protocol()]

    def set_address(self, address: int | str):
        if address in SPECIAL_ADDRESS:
            address = SPECIAL_ADDRESS[address]
        ret = self.setAddress(address)
        if ret is False:
            raise ValueError("invalid address")