Skip to content

Size

Qt Base Class: QSize

Signature: QSize(self) -> None QSize(self, QSize: PySide6.QtCore.QSize) -> None QSize(self, w: int, h: int) -> None

Base classes

Name Children Inherits
QSize
PySide6.QtCore
QSize(self) -> None

⋔ Inheritance diagram

graph TD
  1473299861872["core.Size"]
  1473243794960["QtCore.QSize"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243794960 --> 1473299861872
  1473291690208 --> 1473243794960
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QSize

Defines the size of a two-dimensional object using integer point precision.

Source code in prettyqt\core\size.py
class Size(QtCore.QSize):
    """Defines the size of a two-dimensional object using integer point precision."""

    def __repr__(self):
        return get_repr(self, self.width(), self.height())

    @property
    def _width(self) -> int:
        return self.width()

    @property
    def _height(self) -> int:
        return self.height()

    __match_args__ = ("_width", "_height")

    def __getitem__(self, index) -> int:
        return (self.width(), self.height())[index]

    def __reduce__(self):
        return type(self), (self.width(), self.height())

    def expanded_to(self, size: datatypes.SizeType) -> Self:
        size = datatypes.to_size(size)
        return type(self)(self.expandedTo(size))

    def shrunk_by(self, margins: datatypes.MarginsType) -> Self:
        margins = datatypes.to_margins(margins)
        return type(self)(self.shrunkBy(margins))

    def grown_by(self, margins: datatypes.MarginsType) -> Self:
        margins = datatypes.to_margins(margins)
        return type(self)(self.grownBy(margins))