Skip to content

OperatingSystemVersion

Qt Base Class: QOperatingSystemVersion

Signature: QOperatingSystemVersion(self, QOperatingSystemVersion: PySide6.QtCore.QOperatingSystemVersion) -> None QOperatingSystemVersion(self, osType: PySide6.QtCore.QOperatingSystemVersion.OSType, vmajor: int, vminor: int = -1, vmicro: int = -1) -> None

Base classes

Name Children Inherits
QOperatingSystemVersion
PySide6.QtCore
QOperatingSystemVersion(self, QOperatingSystemVersion: PySide6.QtCore.QOperatingSystemVersion) -> None

⋔ Inheritance diagram

graph TD
  1473299827712["core.OperatingSystemVersion"]
  1473243781296["QtCore.QOperatingSystemVersion"]
  1473243811552["QtCore.QOperatingSystemVersionBase"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243781296 --> 1473299827712
  1473243811552 --> 1473243781296
  1473291690208 --> 1473243811552
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QOperatingSystemVersion

Information about the operating system version.

Source code in prettyqt\core\operatingsystemversion.py
class OperatingSystemVersion(core.QOperatingSystemVersion):
    """Information about the operating system version."""

    def __init__(
        self,
        typ: core.QOperatingSystemVersion.OSType | str,
        major: int,
        minor: int | None = None,
        micro: int | None = None,
    ):
        os_type = OS_TYPE[typ] if isinstance(typ, str) else typ
        if minor is None:
            minor = -1
        if micro is None:
            micro = -1
        super().__init__(os_type, major, minor, micro)

    def __repr__(self):
        return get_repr(
            self,
            self.get_type(),
            self.majorVersion(),
            self.minorVersion(),
            self.microVersion(),
        )

    @property
    def _type(self) -> OsTypeStr:
        return self.get_type()

    @property
    def _majorVersion(self) -> int:
        return self.majorVersion()

    @property
    def _minorVersion(self) -> int:
        return self.minorVersion()

    @property
    def _macroVersion(self) -> int:
        return self.macroVersion()

    __match_args__ = ("_type", "_majorVersion", "_minorVersion", "_macroVersion")

    def __reduce__(self):
        return (
            type(self),
            (
                self.get_type(),
                self.majorVersion(),
                self.minorVersion(),
                self.microVersion(),
            ),
        )

    def __eq__(self, other):
        return (
            (
                self.type() == other.type()
                and self.majorVersion() == other.majorVersion()
                and self.minorVersion() == other.minorVersion()
                and self.microVersion() == other.microVersion()
            )
            if isinstance(other, core.QOperatingSystemVersion)
            else False
        )

    def __hash__(self):
        return hash(
            (
                self.get_type(),
                self.majorVersion(),
                self.minorVersion(),
                self.microVersion(),
            )
        )

    def get_type(self) -> OsTypeStr:
        """Get current os type.

        Returns:
            current os type
        """
        return OS_TYPE.inverse[self.type()]

    def get_versionnumber(self) -> core.VersionNumber:
        return core.VersionNumber(
            self.majorVersion(), self.minorVersion(), self.microVersion()
        )

get_type() -> OsTypeStr

Get current os type.

Source code in prettyqt\core\operatingsystemversion.py
def get_type(self) -> OsTypeStr:
    """Get current os type.

    Returns:
        current os type
    """
    return OS_TYPE.inverse[self.type()]