Skip to content

PythonQt.Qt.QSizePolicy

QSizePolicy

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its QWidget::sizePolicy property.

QSizePolicy contains two independent QSizePolicy::Policy values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the setHorizontalPolicy() and setVerticalPolicy() functions. The stretch factors can be set using the setHorizontalStretch() and setVerticalStretch() functions. The flag indicating whether the widget's sizeHint() is width-dependent (such as a menu bar or a word-wrapping label) can be set using the setHeightForWidth() function.

The current size policies and stretch factors be retrieved using the horizontalPolicy(), verticalPolicy(), horizontalStretch() and verticalStretch() functions. Alternatively, use the transpose() function to swap the horizontal and vertical policies and stretches. The hasHeightForWidth() function returns the current status of the flag indicating the size hint dependencies.

Use the expandingDirections() function to determine whether the associated widget can make use of more space than its sizeHint() function indicates, as well as find out in which directions it can expand.

Finally, the QSizePolicy class provides operators comparing this size policy to a given policy, as well as a QVariant operator storing this QSizePolicy as a QVariant object.

Source: https://doc.qt.io/archives/qt-5.15/qsizepolicy.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
ButtonBox attribute Any (shared captured text)
CheckBox attribute Any (shared captured text)
ComboBox attribute Any (shared captured text)
ControlType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
ControlTypes attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
DefaultType attribute Any (shared captured text)
ExpandFlag attribute Any (shared captured text)
Expanding attribute Any (shared captured text)
Fixed attribute Any (shared captured text)
Frame attribute Any (shared captured text)
GroupBox attribute Any (shared captured text)
GrowFlag attribute Any (shared captured text)
IgnoreFlag attribute Any (shared captured text)
Ignored attribute Any (shared captured text)
Label attribute Any (shared captured text)
Line attribute Any (shared captured text)
LineEdit attribute Any (shared captured text)
Maximum attribute Any (shared captured text)
Minimum attribute Any (shared captured text)
MinimumExpanding attribute Any (shared captured text)
Policy attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PolicyFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Preferred attribute Any (shared captured text)
PushButton attribute Any (shared captured text)
RadioButton attribute Any (shared captured text)
ShrinkFlag attribute Any (shared captured text)
Slider attribute Any (shared captured text)
SpinBox attribute Any (shared captured text)
TabWidget attribute Any (shared captured text)
ToolButton attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
controlType function (self) -> Any Returns the control type associated with the widget for which this size policy applies. (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
expandingDirections function (self) -> Any Returns whether a widget can make use of more space than the [QWidget::sizeHint](https://doc.qt.io/archives/qt-5.15/qwidget.html#sizeHint-prop)() function indicates. (shared captured text)
hasHeightForWidth function (self) -> bool X.hasHeightForWidth() -> bool (shared captured text)
hasWidthForHeight function (self) -> bool X.hasWidthForHeight() -> bool (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
horizontalPolicy function (self) -> Any Returns the horizontal component of the size policy. (shared captured text)
horizontalStretch function (self) -> int X.horizontalStretch() -> int (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
readFrom function (self, arg__1: Any) -> Any (shared captured text)
retainSizeWhenHidden function (self) -> bool X.retainSizeWhenHidden() -> bool (shared captured text)
setControlType function (self, type: Any) -> None Sets the control type associated with the widget for which this size policy applies to type. (shared captured text)
setHeightForWidth function (self, b: bool) -> None Sets the flag determining whether the widget's preferred height depends on its width, to dependent. (shared captured text)
setHorizontalPolicy function (self, d: Any) -> None Sets the horizontal component to the given policy. (shared captured text)
setHorizontalStretch function (self, stretchFactor: int) -> None Sets the horizontal stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range \[0,255\]. (shared captured text)
setRetainSizeWhenHidden function (self, retainSize: bool) -> None Sets whether a layout should retain the widget's size when it is hidden. (shared captured text)
setVerticalPolicy function (self, d: Any) -> None Sets the vertical component to the given policy. (shared captured text)
setVerticalStretch function (self, stretchFactor: int) -> None Sets the vertical stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range \[0,255\]. (shared captured text)
setWidthForHeight function (self, b: bool) -> None Sets the flag determining whether the widget's width depends on its height, to dependent. (shared captured text)
transpose function (self) -> None Swaps the horizontal and vertical policies and stretches. (shared captured text)
verticalPolicy function (self) -> Any Returns the vertical component of the size policy. (shared captured text)
verticalStretch function (self) -> int X.verticalStretch() -> int (shared captured text)
writeTo function (self, arg__1: Any) -> Any (shared captured text)