Struct rute::auto::size_policy::SizePolicy
source · pub struct SizePolicy<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
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.
See also: Size
Widget::size_hint
Widget::size_policy()
LayoutItem::size_hint
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> SizePolicy<'a>
impl<'a> SizePolicy<'a>
pub fn new() -> SizePolicy<'a>
sourcepub fn horizontal_policy(&self) -> Policy
pub fn horizontal_policy(&self) -> Policy
Returns the horizontal component of the size policy.
See also: [set_horizontal_policy()
]
[vertical_policy()
]
[horizontal_stretch()
]
sourcepub fn vertical_policy(&self) -> Policy
pub fn vertical_policy(&self) -> Policy
Returns the vertical component of the size policy.
See also: [set_vertical_policy()
]
[horizontal_policy()
]
[vertical_stretch()
]
sourcepub fn set_horizontal_policy(&self, d: Policy) -> &Self
pub fn set_horizontal_policy(&self, d: Policy) -> &Self
Sets the horizontal component to the given policy.
See also: [horizontal_policy()
]
[set_vertical_policy()
]
[set_horizontal_stretch()
]
sourcepub fn set_vertical_policy(&self, d: Policy) -> &Self
pub fn set_vertical_policy(&self, d: Policy) -> &Self
Sets the vertical component to the given policy.
See also: [vertical_policy()
]
[set_horizontal_policy()
]
[set_vertical_stretch()
]
sourcepub fn expanding_directions(&self) -> Orientations
pub fn expanding_directions(&self) -> Orientations
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: [horizontal_policy()
]
[vertical_policy()
]
sourcepub fn set_height_for_width(&self, b: bool) -> &Self
pub fn set_height_for_width(&self, b: bool) -> &Self
Sets the flag determining whether the widget’s preferred height depends on its width, to dependent.
See also: [has_height_for_width()
]
[set_width_for_height()
]
sourcepub fn has_height_for_width(&self) -> bool
pub fn has_height_for_width(&self) -> bool
Returns true
if the widget’s preferred height depends on its
width; otherwise returns false.
See also: [set_height_for_width()
]
sourcepub fn set_width_for_height(&self, b: bool) -> &Self
pub fn set_width_for_height(&self, b: bool) -> &Self
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: [has_width_for_height()
]
[set_height_for_width()
]
sourcepub fn has_width_for_height(&self) -> bool
pub fn has_width_for_height(&self) -> bool
Returns true
if the widget’s width depends on its
height; otherwise returns false.
See also: [set_width_for_height()
]
Returns whether the layout should retain the widget’s size when it is hidden.
This is false
by default.
See also: [set_retain_size_when_hidden()
]
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.
See also: [retain_size_when_hidden()
]
Trait Implementations
sourceimpl<'a> Clone for SizePolicy<'a>
impl<'a> Clone for SizePolicy<'a>
sourcefn clone(&self) -> SizePolicy<'a>
fn clone(&self) -> SizePolicy<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more