#[repr(C)]pub struct QLayoutItem { /* private fields */ }
Expand description
The QLayoutItem class provides an abstract item that a QLayout manipulates.
C++ class: QLayoutItem
.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
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.
Implementations§
Source§impl QLayoutItem
impl QLayoutItem
Sourcepub unsafe fn alignment(&self) -> QFlags<AlignmentFlag>
pub unsafe fn alignment(&self) -> QFlags<AlignmentFlag>
Returns the alignment of this item.
Calls C++ function: QFlags<Qt::AlignmentFlag> QLayoutItem::alignment() const
.
Returns the alignment of this item.
See also setAlignment().
Sourcepub unsafe fn control_types(&self) -> QFlags<ControlType>
pub unsafe fn control_types(&self) -> QFlags<ControlType>
Returns the control type(s) for the layout item. For a QWidgetItem, the control type comes from the widget's size policy; for a QLayoutItem, the control types is derived from the layout's contents.
Calls C++ function: virtual QFlags<QSizePolicy::ControlType> QLayoutItem::controlTypes() const
.
Returns the control type(s) for the layout item. For a QWidgetItem, the control type comes from the widget’s size policy; for a QLayoutItem, the control types is derived from the layout’s contents.
See also QSizePolicy::controlType().
Sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QLayoutItem>>,
) -> Ref<QLayoutItem>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QLayoutItem>>, ) -> Ref<QLayoutItem>
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Calls C++ function: QLayoutItem& QLayoutItem::operator=(const QLayoutItem& other)
.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
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.
Sourcepub unsafe fn expanding_directions(&self) -> QFlags<Orientation>
pub unsafe fn expanding_directions(&self) -> QFlags<Orientation>
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.
Calls C++ function: pure virtual QFlags<Qt::Orientation> QLayoutItem::expandingDirections() const
.
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 unsafe fn geometry(&self) -> CppBox<QRect>
pub unsafe fn geometry(&self) -> CppBox<QRect>
Returns the rectangle covered by this layout item.
Calls C++ function: pure virtual QRect QLayoutItem::geometry() const
.
Returns the rectangle covered by this layout item.
See also setGeometry().
Sourcepub unsafe fn has_height_for_width(&self) -> bool
pub unsafe 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.
Calls C++ function: virtual bool QLayoutItem::hasHeightForWidth() const
.
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 heightForWidth() and QWidget::heightForWidth().
Sourcepub unsafe fn height_for_width(&self, arg1: c_int) -> c_int
pub unsafe fn height_for_width(&self, arg1: c_int) -> c_int
Returns the preferred height for this layout item, given the width w.
Calls C++ function: virtual int QLayoutItem::heightForWidth(int arg1) const
.
Returns the preferred height for this layout item, given the width w.
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:
int MyLayout::heightForWidth(int w) const { if (cache_dirty || cached_width != w) { // not all C++ compilers support “mutable” MyLayout that = (MyLayout)this; int h = calculateHeightForWidth(w); that->cached_hfw = h; return h; } return cached_hfw; }
Caching is strongly recommended; without it layout will take exponential time.
See also hasHeightForWidth().
Sourcepub unsafe fn invalidate(&self)
pub unsafe fn invalidate(&self)
Invalidates any cached information in this layout item.
Calls C++ function: virtual void QLayoutItem::invalidate()
.
Invalidates any cached information in this layout item.
Sourcepub unsafe fn is_empty(&self) -> bool
pub unsafe fn is_empty(&self) -> bool
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
Calls C++ function: pure virtual bool QLayoutItem::isEmpty() const
.
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
Sourcepub unsafe fn layout(&self) -> QPtr<QLayout>
pub unsafe fn layout(&self) -> QPtr<QLayout>
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned. This function provides type-safe casting.
Calls C++ function: virtual QLayout* QLayoutItem::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 spacerItem() and widget().
Sourcepub unsafe fn maximum_size(&self) -> CppBox<QSize>
pub unsafe fn maximum_size(&self) -> CppBox<QSize>
Implemented in subclasses to return the maximum size of this item.
Calls C++ function: pure virtual QSize QLayoutItem::maximumSize() const
.
Implemented in subclasses to return the maximum size of this item.
Sourcepub unsafe fn minimum_height_for_width(&self, arg1: c_int) -> c_int
pub unsafe fn minimum_height_for_width(&self, arg1: c_int) -> c_int
Returns the minimum height this widget needs for the given width, w. The default implementation simply returns heightForWidth(w).
Calls C++ function: virtual int QLayoutItem::minimumHeightForWidth(int arg1) const
.
Returns the minimum height this widget needs for the given width, w. The default implementation simply returns heightForWidth(w).
Sourcepub unsafe fn minimum_size(&self) -> CppBox<QSize>
pub unsafe fn minimum_size(&self) -> CppBox<QSize>
Implemented in subclasses to return the minimum size of this item.
Calls C++ function: pure virtual QSize QLayoutItem::minimumSize() const
.
Implemented in subclasses to return the minimum size of this item.
Sourcepub unsafe fn set_alignment(&self, a: QFlags<AlignmentFlag>)
pub unsafe fn set_alignment(&self, a: QFlags<AlignmentFlag>)
Sets the alignment of this item to alignment.
Calls C++ function: void QLayoutItem::setAlignment(QFlags<Qt::AlignmentFlag> a)
.
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.
See also alignment().
Sourcepub unsafe fn set_geometry(&self, arg1: impl CastInto<Ref<QRect>>)
pub unsafe fn set_geometry(&self, arg1: impl CastInto<Ref<QRect>>)
Implemented in subclasses to set this item's geometry to r.
Calls C++ function: pure virtual void QLayoutItem::setGeometry(const QRect& arg1)
.
Implemented in subclasses to set this item’s geometry to r.
See also geometry().
Sourcepub unsafe fn size_hint(&self) -> CppBox<QSize>
pub unsafe fn size_hint(&self) -> CppBox<QSize>
Implemented in subclasses to return the preferred size of this item.
Calls C++ function: pure virtual QSize QLayoutItem::sizeHint() const
.
Implemented in subclasses to return the preferred size of this item.
Sourcepub unsafe fn spacer_item(&self) -> Ptr<QSpacerItem>
pub unsafe fn spacer_item(&self) -> Ptr<QSpacerItem>
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. This function provides type-safe casting.
Calls C++ function: virtual QSpacerItem* QLayoutItem::spacerItem()
.
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. This function provides type-safe casting.
Sourcepub unsafe fn widget(&self) -> QPtr<QWidget>
pub unsafe fn widget(&self) -> QPtr<QWidget>
If this item manages a QWidget, returns that widget. Otherwise, nullptr
is returned.
Calls C++ function: virtual QWidget* QLayoutItem::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() and spacerItem().
Trait Implementations§
Source§impl CppDeletable for QLayoutItem
impl CppDeletable for QLayoutItem
Source§unsafe fn delete(&self)
unsafe fn delete(&self)
Destroys the QLayoutItem.
Calls C++ function: virtual [destructor] void QLayoutItem::~QLayoutItem()
.
Destroys the QLayoutItem.
Source§impl DynamicCast<QBoxLayout> for QLayoutItem
impl DynamicCast<QBoxLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>
Calls C++ function: QBoxLayout* dynamic_cast<QBoxLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QFormLayout> for QLayoutItem
impl DynamicCast<QFormLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>
Calls C++ function: QFormLayout* dynamic_cast<QFormLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QGridLayout> for QLayoutItem
impl DynamicCast<QGridLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>
Calls C++ function: QGridLayout* dynamic_cast<QGridLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QHBoxLayout> for QLayoutItem
impl DynamicCast<QHBoxLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>
Calls C++ function: QHBoxLayout* dynamic_cast<QHBoxLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QLayout> for QLayoutItem
impl DynamicCast<QLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>
Calls C++ function: QLayout* dynamic_cast<QLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QSpacerItem> for QLayoutItem
impl DynamicCast<QSpacerItem> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>
Calls C++ function: QSpacerItem* dynamic_cast<QSpacerItem*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QStackedLayout> for QLayoutItem
impl DynamicCast<QStackedLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>
Calls C++ function: QStackedLayout* dynamic_cast<QStackedLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QVBoxLayout> for QLayoutItem
impl DynamicCast<QVBoxLayout> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>
Calls C++ function: QVBoxLayout* dynamic_cast<QVBoxLayout*>(QLayoutItem* ptr)
.
Source§impl DynamicCast<QWidgetItem> for QLayoutItem
impl DynamicCast<QWidgetItem> for QLayoutItem
Source§unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>
unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>
Calls C++ function: QWidgetItem* dynamic_cast<QWidgetItem*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QBoxLayout> for QLayoutItem
impl StaticDowncast<QBoxLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>
Calls C++ function: QBoxLayout* static_cast<QBoxLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QFormLayout> for QLayoutItem
impl StaticDowncast<QFormLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>
Calls C++ function: QFormLayout* static_cast<QFormLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QGridLayout> for QLayoutItem
impl StaticDowncast<QGridLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>
Calls C++ function: QGridLayout* static_cast<QGridLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QHBoxLayout> for QLayoutItem
impl StaticDowncast<QHBoxLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>
Calls C++ function: QHBoxLayout* static_cast<QHBoxLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QLayout> for QLayoutItem
impl StaticDowncast<QLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>
Calls C++ function: QLayout* static_cast<QLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QSpacerItem> for QLayoutItem
impl StaticDowncast<QSpacerItem> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>
Calls C++ function: QSpacerItem* static_cast<QSpacerItem*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QStackedLayout> for QLayoutItem
impl StaticDowncast<QStackedLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>
Calls C++ function: QStackedLayout* static_cast<QStackedLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QVBoxLayout> for QLayoutItem
impl StaticDowncast<QVBoxLayout> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>
Calls C++ function: QVBoxLayout* static_cast<QVBoxLayout*>(QLayoutItem* ptr)
.
Source§impl StaticDowncast<QWidgetItem> for QLayoutItem
impl StaticDowncast<QWidgetItem> for QLayoutItem
Source§unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>
unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>
Calls C++ function: QWidgetItem* static_cast<QWidgetItem*>(QLayoutItem* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QBoxLayout
impl StaticUpcast<QLayoutItem> for QBoxLayout
Source§unsafe fn static_upcast(ptr: Ptr<QBoxLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QBoxLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QBoxLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QFormLayout
impl StaticUpcast<QLayoutItem> for QFormLayout
Source§unsafe fn static_upcast(ptr: Ptr<QFormLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QFormLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QFormLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QGridLayout
impl StaticUpcast<QLayoutItem> for QGridLayout
Source§unsafe fn static_upcast(ptr: Ptr<QGridLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QGridLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QGridLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QHBoxLayout
impl StaticUpcast<QLayoutItem> for QHBoxLayout
Source§unsafe fn static_upcast(ptr: Ptr<QHBoxLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QHBoxLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QHBoxLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QLayout
impl StaticUpcast<QLayoutItem> for QLayout
Source§unsafe fn static_upcast(ptr: Ptr<QLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QSpacerItem
impl StaticUpcast<QLayoutItem> for QSpacerItem
Source§unsafe fn static_upcast(ptr: Ptr<QSpacerItem>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QSpacerItem>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QSpacerItem* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QStackedLayout
impl StaticUpcast<QLayoutItem> for QStackedLayout
Source§unsafe fn static_upcast(ptr: Ptr<QStackedLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QStackedLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QStackedLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QVBoxLayout
impl StaticUpcast<QLayoutItem> for QVBoxLayout
Source§unsafe fn static_upcast(ptr: Ptr<QVBoxLayout>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QVBoxLayout>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QVBoxLayout* ptr)
.
Source§impl StaticUpcast<QLayoutItem> for QWidgetItem
impl StaticUpcast<QLayoutItem> for QWidgetItem
Source§unsafe fn static_upcast(ptr: Ptr<QWidgetItem>) -> Ptr<QLayoutItem>
unsafe fn static_upcast(ptr: Ptr<QWidgetItem>) -> Ptr<QLayoutItem>
Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QWidgetItem* ptr)
.