Struct QLayoutItem

Source
#[repr(C)]
pub struct QLayoutItem { /* private fields */ }
Expand description

The QLayoutItem class provides an abstract item that a QLayout manipulates.

C++ class: QLayoutItem.

C++ documentation:

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

Source

pub unsafe fn alignment(&self) -> QFlags<AlignmentFlag>

Returns the alignment of this item.

Calls C++ function: QFlags<Qt::AlignmentFlag> QLayoutItem::alignment() const.

C++ documentation:

Returns the alignment of this item.

See also setAlignment().

Source

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.

C++ documentation:

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().

Source

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).

C++ documentation:

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.

Source

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.

C++ documentation:

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.

Source

pub unsafe fn geometry(&self) -> CppBox<QRect>

Returns the rectangle covered by this layout item.

Calls C++ function: pure virtual QRect QLayoutItem::geometry() const.

C++ documentation:

Returns the rectangle covered by this layout item.

See also setGeometry().

Source

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.

C++ documentation:

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().

Source

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.

C++ documentation:

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().

Source

pub unsafe fn invalidate(&self)

Invalidates any cached information in this layout item.

Calls C++ function: virtual void QLayoutItem::invalidate().

C++ documentation:

Invalidates any cached information in this layout item.

Source

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.

C++ documentation:

Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.

Source

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().

C++ documentation:

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().

Source

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.

C++ documentation:

Implemented in subclasses to return the maximum size of this item.

Source

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.

C++ documentation:

Returns the minimum height this widget needs for the given width, w. The default implementation simply returns heightForWidth(w).

Source

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.

C++ documentation:

Implemented in subclasses to return the minimum size of this item.

Source

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).

C++ documentation:

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().

Source

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).

C++ documentation:

Implemented in subclasses to set this item’s geometry to r.

See also geometry().

Source

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.

C++ documentation:

Implemented in subclasses to return the preferred size of this item.

Source

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().

C++ documentation:

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() and widget().

Source

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().

C++ documentation:

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

Source§

unsafe fn delete(&self)

Destroys the QLayoutItem.

Calls C++ function: virtual [destructor] void QLayoutItem::~QLayoutItem().

C++ documentation:

Destroys the QLayoutItem.

Source§

impl DynamicCast<QBoxLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>

Calls C++ function: QBoxLayout* dynamic_cast<QBoxLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QFormLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>

Calls C++ function: QFormLayout* dynamic_cast<QFormLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QGridLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>

Calls C++ function: QGridLayout* dynamic_cast<QGridLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QHBoxLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>

Calls C++ function: QHBoxLayout* dynamic_cast<QHBoxLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>

Calls C++ function: QLayout* dynamic_cast<QLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QSpacerItem> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>

Calls C++ function: QSpacerItem* dynamic_cast<QSpacerItem*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QStackedLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>

Calls C++ function: QStackedLayout* dynamic_cast<QStackedLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QVBoxLayout> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>

Calls C++ function: QVBoxLayout* dynamic_cast<QVBoxLayout*>(QLayoutItem* ptr).

Source§

impl DynamicCast<QWidgetItem> for QLayoutItem

Source§

unsafe fn dynamic_cast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>

Calls C++ function: QWidgetItem* dynamic_cast<QWidgetItem*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QBoxLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QBoxLayout>

Calls C++ function: QBoxLayout* static_cast<QBoxLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QFormLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QFormLayout>

Calls C++ function: QFormLayout* static_cast<QFormLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QGridLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QGridLayout>

Calls C++ function: QGridLayout* static_cast<QGridLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QHBoxLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QHBoxLayout>

Calls C++ function: QHBoxLayout* static_cast<QHBoxLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QLayout>

Calls C++ function: QLayout* static_cast<QLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QSpacerItem> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QSpacerItem>

Calls C++ function: QSpacerItem* static_cast<QSpacerItem*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QStackedLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QStackedLayout>

Calls C++ function: QStackedLayout* static_cast<QStackedLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QVBoxLayout> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QVBoxLayout>

Calls C++ function: QVBoxLayout* static_cast<QVBoxLayout*>(QLayoutItem* ptr).

Source§

impl StaticDowncast<QWidgetItem> for QLayoutItem

Source§

unsafe fn static_downcast(ptr: Ptr<QLayoutItem>) -> Ptr<QWidgetItem>

Calls C++ function: QWidgetItem* static_cast<QWidgetItem*>(QLayoutItem* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QBoxLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QBoxLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QBoxLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QFormLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QFormLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QFormLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QGridLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QGridLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QGridLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QHBoxLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QHBoxLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QHBoxLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QSpacerItem

Source§

unsafe fn static_upcast(ptr: Ptr<QSpacerItem>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QSpacerItem* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QStackedLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QStackedLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QStackedLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QVBoxLayout

Source§

unsafe fn static_upcast(ptr: Ptr<QVBoxLayout>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QVBoxLayout* ptr).

Source§

impl StaticUpcast<QLayoutItem> for QWidgetItem

Source§

unsafe fn static_upcast(ptr: Ptr<QWidgetItem>) -> Ptr<QLayoutItem>

Calls C++ function: QLayoutItem* static_cast<QLayoutItem*>(QWidgetItem* ptr).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StaticUpcast<T> for T

Source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.