[][src]Struct qt_widgets::QWidgetItem

#[repr(C)]pub struct QWidgetItem { /* fields omitted */ }

The QWidgetItem class is a layout item that represents a widget.

C++ class: QWidgetItem.

C++ documentation:

The QWidgetItem class is a layout item that represents a widget.

Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating widgets in layouts:

Methods

impl QWidgetItem[src]

pub unsafe fn control_types(&self) -> QFlags<ControlType>[src]

Reimplemented from QLayoutItem::controlTypes().

Calls C++ function: virtual QFlags<QSizePolicy::ControlType> QWidgetItem::controlTypes() const.

C++ documentation:

Reimplemented from QLayoutItem::controlTypes().

Returns the control type associated with the widget for which this size policy applies.

See also QSizePolicy::controlType().

pub unsafe fn expanding_directions(&self) -> QFlags<Orientation>[src]

Reimplemented from QLayoutItem::expandingDirections().

Calls C++ function: virtual QFlags<Qt::Orientation> QWidgetItem::expandingDirections() const.

C++ documentation:

Reimplemented from QLayoutItem::expandingDirections().

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

Reimplemented from QLayoutItem::geometry().

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

C++ documentation:

Reimplemented from QLayoutItem::geometry().

See also setGeometry().

pub unsafe fn has_height_for_width(&self) -> bool[src]

Reimplemented from QLayoutItem::hasHeightForWidth().

Calls C++ function: virtual bool QWidgetItem::hasHeightForWidth() const.

C++ documentation:

Reimplemented from QLayoutItem::hasHeightForWidth().

pub unsafe fn height_for_width(&self, arg1: c_int) -> c_int[src]

Reimplemented from QLayoutItem::heightForWidth().

Calls C++ function: virtual int QWidgetItem::heightForWidth(int arg1) const.

C++ documentation:

Reimplemented from QLayoutItem::heightForWidth().

pub unsafe fn is_empty(&self) -> bool[src]

Reimplemented from QLayoutItem::isEmpty().

Calls C++ function: virtual bool QWidgetItem::isEmpty() const.

C++ documentation:

Reimplemented from QLayoutItem::isEmpty().

Returns true if the widget is hidden; otherwise returns false.

See also QWidget::isHidden().

pub unsafe fn maximum_size(&self) -> CppBox<QSize>[src]

Reimplemented from QLayoutItem::maximumSize().

Calls C++ function: virtual QSize QWidgetItem::maximumSize() const.

C++ documentation:

Reimplemented from QLayoutItem::maximumSize().

pub unsafe fn minimum_size(&self) -> CppBox<QSize>[src]

Reimplemented from QLayoutItem::minimumSize().

Calls C++ function: virtual QSize QWidgetItem::minimumSize() const.

C++ documentation:

Reimplemented from QLayoutItem::minimumSize().

pub unsafe fn new(w: impl CastInto<Ptr<QWidget>>) -> CppBox<QWidgetItem>[src]

Creates an item containing the given widget.

Calls C++ function: [constructor] void QWidgetItem::QWidgetItem(QWidget* w).

C++ documentation:

Creates an item containing the given widget.

pub unsafe fn set_geometry(&self, arg1: impl CastInto<Ref<QRect>>)[src]

Reimplemented from QLayoutItem::setGeometry().

Calls C++ function: virtual void QWidgetItem::setGeometry(const QRect& arg1).

C++ documentation:

Reimplemented from QLayoutItem::setGeometry().

See also geometry().

pub unsafe fn size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QLayoutItem::sizeHint().

Calls C++ function: virtual QSize QWidgetItem::sizeHint() const.

C++ documentation:

Reimplemented from QLayoutItem::sizeHint().

pub unsafe fn widget(&self) -> QPtr<QWidget>[src]

Reimplemented from QLayoutItem::widget().

Calls C++ function: virtual QWidget* QWidgetItem::widget().

C++ documentation:

Reimplemented from QLayoutItem::widget().

Returns the widget managed by this item.

Methods from Deref<Target = QLayoutItem>

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

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

pub unsafe fn control_types(&self) -> QFlags<ControlType>[src]

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

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QLayoutItem>>
) -> Ref<QLayoutItem>
[src]

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.

pub unsafe fn expanding_directions(&self) -> QFlags<Orientation>[src]

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.

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

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

pub unsafe fn has_height_for_width(&self) -> bool[src]

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

pub unsafe fn height_for_width(&self, arg1: c_int) -> c_int[src]

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

pub unsafe fn invalidate(&self)[src]

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.

pub unsafe fn is_empty(&self) -> bool[src]

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.

pub unsafe fn layout(&self) -> QPtr<QLayout>[src]

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

pub unsafe fn maximum_size(&self) -> CppBox<QSize>[src]

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.

pub unsafe fn minimum_height_for_width(&self, arg1: c_int) -> c_int[src]

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

pub unsafe fn minimum_size(&self) -> CppBox<QSize>[src]

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.

pub unsafe fn set_alignment(&self, a: QFlags<AlignmentFlag>)[src]

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

pub unsafe fn set_geometry(&self, arg1: impl CastInto<Ref<QRect>>)[src]

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

pub unsafe fn size_hint(&self) -> CppBox<QSize>[src]

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.

pub unsafe fn spacer_item(&self) -> Ptr<QSpacerItem>[src]

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

pub unsafe fn widget(&self) -> QPtr<QWidget>[src]

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

impl CppDeletable for QWidgetItem[src]

unsafe fn delete(&self)[src]

Destructor.

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

C++ documentation:

Destructor.

impl Deref for QWidgetItem[src]

type Target = QLayoutItem

The resulting type after dereferencing.

fn deref(&self) -> &QLayoutItem[src]

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

impl DynamicCast<QWidgetItem> for QLayoutItem[src]

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

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

impl StaticDowncast<QWidgetItem> for QLayoutItem[src]

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

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

impl StaticUpcast<QLayoutItem> for QWidgetItem[src]

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

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.