Struct rute::auto::layout_item::LayoutItem
source · pub struct LayoutItem<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
This is used by custom layouts.
Pure virtual functions are provided to return information about the layout, including, sizeHint(), minimumSize(), maximumSize() and expanding().
The layout’s geometry can be set and retrieved with setGeometry() and geometry(), and its alignment with setAlignment() and alignment().
isEmpty() returns whether the layout item is empty. If the concrete item is a QWidget, it can be retrieved using widget(). Similarly for layout() and spacerItem().
Some layouts have width and height interdependencies. These can be expressed using hasHeightForWidth(), heightForWidth(), and minimumHeightForWidth(). For more explanation see the Qt Quarterly article Trading Height for Width
See also: Layout
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> LayoutItem<'a>
impl<'a> LayoutItem<'a>
sourcepub fn size_hint(&self) -> Size<'_>
pub fn size_hint(&self) -> Size<'_>
Implemented in subclasses to return the preferred size of this item.
sourcepub fn minimum_size(&self) -> Size<'_>
pub fn minimum_size(&self) -> Size<'_>
Implemented in subclasses to return the minimum size of this item.
sourcepub fn maximum_size(&self) -> Size<'_>
pub fn maximum_size(&self) -> Size<'_>
Implemented in subclasses to return the maximum size of this item.
sourcepub fn expanding_directions(&self) -> Orientations
pub fn expanding_directions(&self) -> Orientations
Returns whether this layout item can make use of more space than sizeHint(). A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only one dimension, whereas Qt::Vertical | Qt::Horizontal means that it wants to grow in both dimensions.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
sourcepub fn has_height_for_width(&self) -> bool
pub fn has_height_for_width(&self) -> bool
Returns true
if this layout’s preferred height depends on its
width; otherwise returns false.
The default implementation returns
false.
Reimplement this function in layout managers that support height for width.
See also: [height_for_width()
]
Widget::height_for_width
sourcepub fn height_for_width(&self, arg0: i32) -> i32
pub fn height_for_width(&self, arg0: i32) -> i32
Returns the preferred height for this layout item, given the width, which is not used in this default implementation.
The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function hasHeightForWidth() will typically be much faster than calling this function and testing for -1.
Reimplement this function in layout managers that support height for width. A typical implementation will look like this:
Caching is strongly recommended; without it layout will take exponential time.
See also: [has_height_for_width()
]
sourcepub fn minimum_height_for_width(&self, arg0: i32) -> i32
pub fn minimum_height_for_width(&self, arg0: i32) -> i32
Returns the minimum height this widget needs for the given width, w. The default implementation simply returns heightForWidth( w).
sourcepub fn invalidate(&self) -> &Self
pub fn invalidate(&self) -> &Self
Invalidates any cached information in this layout item.
sourcepub fn widget(&self) -> Option<Widget<'_>>
pub fn widget(&self) -> Option<Widget<'_>>
If this item manages a QWidget, returns that widget. Otherwise,
nullptr
is returned.
Note: While the functions layout() and spacerItem() perform casts, this function returns another object: QLayout and QSpacerItem inherit QLayoutItem, while QWidget does not.
See also: [layout()
]
[spacer_item()
]
sourcepub fn layout(&self) -> Option<Layout<'_>>
pub fn layout(&self) -> Option<Layout<'_>>
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned. This function provides type-safe casting.
See also: [spacer_item()
]
[widget()
]
sourcepub fn spacer_item(&self) -> Option<SpacerItem<'_>>
pub fn spacer_item(&self) -> Option<SpacerItem<'_>>
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. This function provides type-safe casting.
See also: [layout()
]
[widget()
]
sourcepub fn set_alignment(&self, a: Alignment) -> &Self
pub fn set_alignment(&self, a: Alignment) -> &Self
Sets the alignment of this item to alignment.
Note: Item alignment is only supported by QLayoutItem subclasses where it would have a visual effect. Except for QSpacerItem, which provides blank space for layouts, all public Qt classes that inherit QLayoutItem support item alignment.
pub fn build(&self) -> Self
Trait Implementations
sourceimpl<'a> Clone for LayoutItem<'a>
impl<'a> Clone for LayoutItem<'a>
sourcefn clone(&self) -> LayoutItem<'a>
fn clone(&self) -> LayoutItem<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more