#[repr(C)]pub struct QSizePolicy { /* private fields */ }
Expand description
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
C++ class: QSizePolicy
.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
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.
Implementations§
Source§impl QSizePolicy
impl QSizePolicy
Sourcepub unsafe fn control_type(&self) -> ControlType
pub unsafe fn control_type(&self) -> ControlType
Returns the control type associated with the widget for which this size policy applies.
Calls C++ function: QSizePolicy::ControlType QSizePolicy::controlType() const
.
Returns the control type associated with the widget for which this size policy applies.
This function was introduced in Qt 4.3.
See also setControlType().
Sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QSizePolicy>>,
) -> Ref<QSizePolicy>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QSizePolicy>>, ) -> Ref<QSizePolicy>
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Calls C++ function: QSizePolicy& QSizePolicy::operator=(const QSizePolicy& other)
.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
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.
Sourcepub unsafe fn expanding_directions(&self) -> QFlags<Orientation>
pub unsafe fn expanding_directions(&self) -> QFlags<Orientation>
Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.
Calls C++ function: QFlags<Qt::Orientation> QSizePolicy::expandingDirections() const
.
Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.
A value of Qt::Horizontal or Qt::Vertical means that the widget can grow horizontally or vertically (i.e., the horizontal or vertical policy is Expanding or MinimumExpanding), whereas Qt::Horizontal | Qt::Vertical means that it can grow in both dimensions.
See also horizontalPolicy() and verticalPolicy().
Sourcepub unsafe fn has_height_for_width(&self) -> bool
pub unsafe fn has_height_for_width(&self) -> bool
Returns true
if the widget's preferred height depends on its width; otherwise returns false
.
Calls C++ function: bool QSizePolicy::hasHeightForWidth() const
.
Returns true
if the widget’s preferred height depends on its width; otherwise returns false
.
See also setHeightForWidth().
Sourcepub unsafe fn has_width_for_height(&self) -> bool
pub unsafe fn has_width_for_height(&self) -> bool
Returns true
if the widget's width depends on its height; otherwise returns false
.
Calls C++ function: bool QSizePolicy::hasWidthForHeight() const
.
Returns true
if the widget’s width depends on its height; otherwise returns false
.
See also setWidthForHeight().
Sourcepub unsafe fn horizontal_policy(&self) -> Policy
pub unsafe fn horizontal_policy(&self) -> Policy
Returns the horizontal component of the size policy.
Calls C++ function: QSizePolicy::Policy QSizePolicy::horizontalPolicy() const
.
Returns the horizontal component of the size policy.
See also setHorizontalPolicy(), verticalPolicy(), and horizontalStretch().
Sourcepub unsafe fn horizontal_stretch(&self) -> c_int
pub unsafe fn horizontal_stretch(&self) -> c_int
Returns the horizontal stretch factor of the size policy.
Calls C++ function: int QSizePolicy::horizontalStretch() const
.
Returns the horizontal stretch factor of the size policy.
See also setHorizontalStretch(), verticalStretch(), and horizontalPolicy().
Sourcepub unsafe fn new_0a() -> CppBox<QSizePolicy>
pub unsafe fn new_0a() -> CppBox<QSizePolicy>
Constructs a QSizePolicy object with Fixed as its horizontal and vertical policies.
Calls C++ function: [constructor] void QSizePolicy::QSizePolicy()
.
Constructs a QSizePolicy object with Fixed as its horizontal and vertical policies.
The policies can be altered using the setHorizontalPolicy() and setVerticalPolicy() functions. Use the setHeightForWidth() function if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
See also setHorizontalStretch() and setVerticalStretch().
Sourcepub unsafe fn new_3a(
horizontal: Policy,
vertical: Policy,
type_: ControlType,
) -> CppBox<QSizePolicy>
pub unsafe fn new_3a( horizontal: Policy, vertical: Policy, type_: ControlType, ) -> CppBox<QSizePolicy>
Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.
Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical, QSizePolicy::ControlType type = …)
.
Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.
Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
This function was introduced in Qt 4.3.
See also setHorizontalStretch(), setVerticalStretch(), and controlType().
Sourcepub unsafe fn new_2a(
horizontal: Policy,
vertical: Policy,
) -> CppBox<QSizePolicy>
pub unsafe fn new_2a( horizontal: Policy, vertical: Policy, ) -> CppBox<QSizePolicy>
Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.
Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
.
Constructs a QSizePolicy object with the given horizontal and vertical policies, and the specified control type.
Use setHeightForWidth() if the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
This function was introduced in Qt 4.3.
See also setHorizontalStretch(), setVerticalStretch(), and controlType().
Sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QSizePolicy>>,
) -> CppBox<QSizePolicy>
pub unsafe fn new_copy( other: impl CastInto<Ref<QSizePolicy>>, ) -> CppBox<QSizePolicy>
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Calls C++ function: [constructor] void QSizePolicy::QSizePolicy(const QSizePolicy& other)
.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
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.
Returns whether the layout should retain the widget's size when it is hidden. This is false
by default.
Calls C++ function: bool QSizePolicy::retainSizeWhenHidden() const
.
Returns whether the layout should retain the widget’s size when it is hidden. This is false
by default.
This function was introduced in Qt 5.2.
See also setRetainSizeWhenHidden().
Sourcepub unsafe fn set_control_type(&self, type_: ControlType)
pub unsafe fn set_control_type(&self, type_: ControlType)
Sets the control type associated with the widget for which this size policy applies to type.
Calls C++ function: void QSizePolicy::setControlType(QSizePolicy::ControlType type)
.
Sets the control type associated with the widget for which this size policy applies to type.
The control type specifies the type of the widget for which this size policy applies. It is used by some styles, notably QMacStyle, to insert proper spacing between widgets. For example, the macOS Aqua guidelines specify that push buttons should be separated by 12 pixels, whereas vertically stacked radio buttons only require 6 pixels.
This function was introduced in Qt 4.3.
See also controlType() and QStyle::layoutSpacing().
Sourcepub unsafe fn set_height_for_width(&self, b: bool)
pub unsafe fn set_height_for_width(&self, b: bool)
Sets the flag determining whether the widget's preferred height depends on its width, to dependent.
Calls C++ function: void QSizePolicy::setHeightForWidth(bool b)
.
Sets the flag determining whether the widget’s preferred height depends on its width, to dependent.
See also hasHeightForWidth() and setWidthForHeight().
Sourcepub unsafe fn set_horizontal_policy(&self, d: Policy)
pub unsafe fn set_horizontal_policy(&self, d: Policy)
Sets the horizontal component to the given policy.
Calls C++ function: void QSizePolicy::setHorizontalPolicy(QSizePolicy::Policy d)
.
Sets the horizontal component to the given policy.
See also horizontalPolicy(), setVerticalPolicy(), and setHorizontalStretch().
Sourcepub unsafe fn set_horizontal_stretch(&self, stretch_factor: c_int)
pub unsafe fn set_horizontal_stretch(&self, stretch_factor: c_int)
Sets the horizontal stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].
Calls C++ function: void QSizePolicy::setHorizontalStretch(int stretchFactor)
.
Sets the horizontal stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].
When two widgets are adjacent to each other in a horizontal layout, setting the horizontal stretch factor of the widget on the left to 2 and the factor of widget on the right to 1 will ensure that the widget on the left will always be twice the size of the one on the right.
See also horizontalStretch(), setVerticalStretch(), and setHorizontalPolicy().
Sets whether a layout should retain the widget's size when it is hidden. If retainSize is true
, the layout will not be changed by hiding the widget.
Calls C++ function: void QSizePolicy::setRetainSizeWhenHidden(bool retainSize)
.
Sets whether a layout should retain the widget’s size when it is hidden. If retainSize is true
, the layout will not be changed by hiding the widget.
This function was introduced in Qt 5.2.
See also retainSizeWhenHidden().
Sourcepub unsafe fn set_vertical_policy(&self, d: Policy)
pub unsafe fn set_vertical_policy(&self, d: Policy)
Sets the vertical component to the given policy.
Calls C++ function: void QSizePolicy::setVerticalPolicy(QSizePolicy::Policy d)
.
Sets the vertical component to the given policy.
See also verticalPolicy(), setHorizontalPolicy(), and setVerticalStretch().
Sourcepub unsafe fn set_vertical_stretch(&self, stretch_factor: c_int)
pub unsafe fn set_vertical_stretch(&self, stretch_factor: c_int)
Sets the vertical stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].
Calls C++ function: void QSizePolicy::setVerticalStretch(int stretchFactor)
.
Sets the vertical stretch factor of the size policy to the given stretchFactor. stretchFactor must be in the range [0,255].
When two widgets are adjacent to each other in a vertical layout, setting the vertical stretch factor of the widget on the top to 2 and the factor of widget on the bottom to 1 will ensure that the widget on the top will always be twice the size of the one on the bottom.
See also verticalStretch(), setHorizontalStretch(), and setVerticalPolicy().
Sourcepub unsafe fn set_width_for_height(&self, b: bool)
pub unsafe fn set_width_for_height(&self, b: bool)
Sets the flag determining whether the widget's width depends on its height, to dependent.
Calls C++ function: void QSizePolicy::setWidthForHeight(bool b)
.
Sets the flag determining whether the widget’s width depends on its height, to dependent.
This is only supported for QGraphicsLayout's subclasses. It is not possible to have a layout with both height-for-width and width-for-height constraints at the same time.
See also hasWidthForHeight() and setHeightForWidth().
Sourcepub unsafe fn static_meta_object() -> Ref<QMetaObject>
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
Returns a reference to the staticMetaObject
field.
Sourcepub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>
Returns a QVariant storing this QSizePolicy.
Calls C++ function: QVariant QSizePolicy::operator QVariant() const
.
Returns a QVariant storing this QSizePolicy.
Sourcepub unsafe fn transpose(&self)
pub unsafe fn transpose(&self)
Swaps the horizontal and vertical policies and stretches.
Calls C++ function: void QSizePolicy::transpose()
.
Swaps the horizontal and vertical policies and stretches.
See also transposed().
Sourcepub unsafe fn transposed(&self) -> CppBox<QSizePolicy>
pub unsafe fn transposed(&self) -> CppBox<QSizePolicy>
Returns a size policy object with the horizontal and vertical policies and stretches swapped.
Calls C++ function: QSizePolicy QSizePolicy::transposed() const
.
Returns a size policy object with the horizontal and vertical policies and stretches swapped.
This function was introduced in Qt 5.9.
See also transpose().
Sourcepub unsafe fn vertical_policy(&self) -> Policy
pub unsafe fn vertical_policy(&self) -> Policy
Returns the vertical component of the size policy.
Calls C++ function: QSizePolicy::Policy QSizePolicy::verticalPolicy() const
.
Returns the vertical component of the size policy.
See also setVerticalPolicy(), horizontalPolicy(), and verticalStretch().
Sourcepub unsafe fn vertical_stretch(&self) -> c_int
pub unsafe fn vertical_stretch(&self) -> c_int
Returns the vertical stretch factor of the size policy.
Calls C++ function: int QSizePolicy::verticalStretch() const
.
Returns the vertical stretch factor of the size policy.
See also setVerticalStretch(), horizontalStretch(), and verticalPolicy().
Trait Implementations§
Source§impl CppDeletable for QSizePolicy
impl CppDeletable for QSizePolicy
Source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Calls C++ function: [destructor] void QSizePolicy::~QSizePolicy()
.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
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§impl PartialEq<Ref<QSizePolicy>> for QSizePolicy
impl PartialEq<Ref<QSizePolicy>> for QSizePolicy
Source§fn eq(&self, s: &Ref<QSizePolicy>) -> bool
fn eq(&self, s: &Ref<QSizePolicy>) -> bool
Returns true
if this policy is equal to other; otherwise returns false
.
Calls C++ function: bool QSizePolicy::operator==(const QSizePolicy& s) const
.
Returns true
if this policy is equal to other; otherwise returns false
.
See also operator!=().