Skip to content

SizeF

Qt Base Class: QSizeF

Signature: QSizeF(self) -> None QSizeF(self, QSizeF: Union[PySide6.QtCore.QSizeF, PySide6.QtCore.QSize]) -> None QSizeF(self, sz: PySide6.QtCore.QSize) -> None QSizeF(self, w: float, h: float) -> None

Base classes

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

⋔ Inheritance diagram

graph TD
  1473299876512["core.SizeF"]
  1473243785200["QtCore.QSizeF"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243785200 --> 1473299876512
  1473291690208 --> 1473243785200
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QSizeF

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

Source code in prettyqt\core\sizef.py
class SizeF(QtCore.QSizeF):
    """Defines the size of a two-dimensional object using floating point precision."""

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

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

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

    __match_args__ = ("_width", "_height")

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

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

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

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

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