[][src]Struct qt_widgets::QStackedLayout

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

The QStackedLayout class provides a stack of widgets where only one widget is visible at a time.

C++ class: QStackedLayout.

C++ documentation:

The QStackedLayout class provides a stack of widgets where only one widget is visible at a time.

QStackedLayout can be used to create a user interface similar to the one provided by QTabWidget. There is also a convenience QStackedWidget class built on top of QStackedLayout.

A QStackedLayout can be populated with a number of child widgets ("pages"). For example:

QWidget firstPageWidget = new QWidget; QWidget secondPageWidget = new QWidget; QWidget *thirdPageWidget = new QWidget;

QStackedLayout *stackedLayout = new QStackedLayout; stackedLayout->addWidget(firstPageWidget); stackedLayout->addWidget(secondPageWidget); stackedLayout->addWidget(thirdPageWidget);

QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(stackedLayout); setLayout(mainLayout);

QStackedLayout provides no intrinsic means for the user to switch page. This is typically done through a QComboBox or a QListWidget that stores the titles of the QStackedLayout's pages. For example:

QComboBox *pageComboBox = new QComboBox; pageComboBox->addItem(tr("Page 1")); pageComboBox->addItem(tr("Page 2")); pageComboBox->addItem(tr("Page 3")); connect(pageComboBox, SIGNAL(activated(int)), stackedLayout, SLOT(setCurrentIndex(int)));

When populating a layout, the widgets are added to an internal list. The indexOf() function returns the index of a widget in that list. The widgets can either be added to the end of the list using the addWidget() function, or inserted at a given index using the insertWidget() function. The removeWidget() function removes the widget at the given index from the layout. The number of widgets contained in the layout, can be obtained using the count() function.

The widget() function returns the widget at a given index position. The index of the widget that is shown on screen is given by currentIndex() and can be changed using setCurrentIndex(). In a similar manner, the currently shown widget can be retrieved using the currentWidget() function, and altered using the setCurrentWidget() function.

Whenever the current widget in the layout changes or a widget is removed from the layout, the currentChanged() and widgetRemoved() signals are emitted respectively.

Methods

impl QStackedLayout[src]

pub fn widget_removed(&self) -> Signal<(c_int,)>[src]

This signal is emitted whenever a widget is removed from the layout. The widget's index is passed as parameter.

Returns a built-in Qt signal QStackedLayout::widgetRemoved that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever a widget is removed from the layout. The widget's index is passed as parameter.

See also removeWidget().

pub fn current_changed(&self) -> Signal<(c_int,)>[src]

This signal is emitted whenever the current widget in the layout changes. The index specifies the index of the new current widget, or -1 if there isn't a new one (for example, if there are no widgets in the QStackedLayout)

Returns a built-in Qt signal QStackedLayout::currentChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the current widget in the layout changes. The index specifies the index of the new current widget, or -1 if there isn't a new one (for example, if there are no widgets in the QStackedLayout)

Note: Notifier signal for property currentIndex.

See also currentWidget() and setCurrentWidget().

pub fn slot_set_current_index(&self) -> Receiver<(c_int,)>[src]

This property holds the index position of the widget that is visible

Returns a built-in Qt slot QStackedLayout::setCurrentIndex that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds the index position of the widget that is visible

The current index is -1 if there is no current widget.

Access functions:

int currentIndex() const
void setCurrentIndex(int index)

Notifier signal:

void currentChanged(int index)

See also currentWidget() and indexOf().

pub fn slot_set_current_widget(&self) -> Receiver<(*mut QWidget,)>[src]

Sets the current widget to be the specified widget. The new current widget must already be contained in this stacked layout.

Returns a built-in Qt slot QStackedLayout::setCurrentWidget that can be passed to qt_core::Signal::connect.

C++ documentation:

Sets the current widget to be the specified widget. The new current widget must already be contained in this stacked layout.

See also setCurrentIndex() and currentWidget().

pub unsafe fn add_item(&self, item: impl CastInto<Ptr<QLayoutItem>>)[src]

Reimplemented from QLayout::addItem().

Calls C++ function: virtual void QStackedLayout::addItem(QLayoutItem* item).

C++ documentation:

Reimplemented from QLayout::addItem().

pub unsafe fn add_widget(&self, w: impl CastInto<Ptr<QWidget>>) -> c_int[src]

Adds the given widget to the end of this layout and returns the index position of the widget.

Calls C++ function: int QStackedLayout::addWidget(QWidget* w).

C++ documentation:

Adds the given widget to the end of this layout and returns the index position of the widget.

If the QStackedLayout is empty before this function is called, the given widget becomes the current widget.

See also insertWidget(), removeWidget(), and setCurrentWidget().

pub unsafe fn count(&self) -> c_int[src]

This property holds the number of widgets contained in the layout

Calls C++ function: virtual int QStackedLayout::count() const.

C++ documentation:

This property holds the number of widgets contained in the layout

Access functions:

virtual int count() const

See also currentIndex() and widget().

pub unsafe fn current_index(&self) -> c_int[src]

This property holds the index position of the widget that is visible

Calls C++ function: int QStackedLayout::currentIndex() const.

C++ documentation:

This property holds the index position of the widget that is visible

The current index is -1 if there is no current widget.

Access functions:

int currentIndex() const
void setCurrentIndex(int index)

Notifier signal:

void currentChanged(int index)

See also currentWidget() and indexOf().

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

Returns the current widget, or 0 if there are no widgets in this layout.

Calls C++ function: QWidget* QStackedLayout::currentWidget() const.

C++ documentation:

Returns the current widget, or 0 if there are no widgets in this layout.

See also currentIndex() and setCurrentWidget().

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

Reimplemented from QLayoutItem::hasHeightForWidth().

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

C++ documentation:

Reimplemented from QLayoutItem::hasHeightForWidth().

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

Reimplemented from QLayoutItem::heightForWidth().

Calls C++ function: virtual int QStackedLayout::heightForWidth(int width) const.

C++ documentation:

Reimplemented from QLayoutItem::heightForWidth().

pub unsafe fn insert_widget(
    &self,
    index: c_int,
    w: impl CastInto<Ptr<QWidget>>
) -> c_int
[src]

Inserts the given widget at the given index in this QStackedLayout. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).

Calls C++ function: int QStackedLayout::insertWidget(int index, QWidget* w).

C++ documentation:

Inserts the given widget at the given index in this QStackedLayout. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).

If the QStackedLayout is empty before this function is called, the given widget becomes the current widget.

Inserting a new widget at an index less than or equal to the current index will increment the current index, but keep the current widget.

See also addWidget(), removeWidget(), and setCurrentWidget().

pub unsafe fn item_at(&self, arg1: c_int) -> Ptr<QLayoutItem>[src]

Reimplemented from QLayout::itemAt().

Calls C++ function: virtual QLayoutItem* QStackedLayout::itemAt(int arg1) const.

C++ documentation:

Reimplemented from QLayout::itemAt().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QStackedLayout::metaObject() const.

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

Reimplemented from QLayoutItem::minimumSize().

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

C++ documentation:

Reimplemented from QLayoutItem::minimumSize().

pub unsafe fn new() -> QBox<QStackedLayout>[src]

Constructs a QStackedLayout with no parent.

Calls C++ function: [constructor] void QStackedLayout::QStackedLayout().

C++ documentation:

Constructs a QStackedLayout with no parent.

This QStackedLayout must be installed on a widget later on to become effective.

See also addWidget() and insertWidget().

pub unsafe fn from_q_widget(
    parent: impl CastInto<Ptr<QWidget>>
) -> QBox<QStackedLayout>
[src]

Constructs a new QStackedLayout with the given parent.

Calls C++ function: [constructor] void QStackedLayout::QStackedLayout(QWidget* parent).

C++ documentation:

Constructs a new QStackedLayout with the given parent.

This layout will install itself on the parent widget and manage the geometry of its children.

pub unsafe fn from_q_layout(
    parent_layout: impl CastInto<Ptr<QLayout>>
) -> QBox<QStackedLayout>
[src]

Constructs a new QStackedLayout and inserts it into the given parentLayout.

Calls C++ function: [constructor] void QStackedLayout::QStackedLayout(QLayout* parentLayout).

C++ documentation:

Constructs a new QStackedLayout and inserts it into the given parentLayout.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QStackedLayout::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QStackedLayout::qt_metacast(const char* arg1).

pub unsafe fn set_current_index(&self, index: c_int)[src]

This property holds the index position of the widget that is visible

Calls C++ function: [slot] void QStackedLayout::setCurrentIndex(int index).

C++ documentation:

This property holds the index position of the widget that is visible

The current index is -1 if there is no current widget.

Access functions:

int currentIndex() const
void setCurrentIndex(int index)

Notifier signal:

void currentChanged(int index)

See also currentWidget() and indexOf().

pub unsafe fn set_current_widget(&self, w: impl CastInto<Ptr<QWidget>>)[src]

Sets the current widget to be the specified widget. The new current widget must already be contained in this stacked layout.

Calls C++ function: [slot] void QStackedLayout::setCurrentWidget(QWidget* w).

C++ documentation:

Sets the current widget to be the specified widget. The new current widget must already be contained in this stacked layout.

See also setCurrentIndex() and currentWidget().

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

Reimplemented from QLayoutItem::setGeometry().

Calls C++ function: virtual void QStackedLayout::setGeometry(const QRect& rect).

C++ documentation:

Reimplemented from QLayoutItem::setGeometry().

pub unsafe fn set_stacking_mode(&self, stacking_mode: StackingMode)[src]

determines the way visibility of child widgets are handled.

Calls C++ function: void QStackedLayout::setStackingMode(QStackedLayout::StackingMode stackingMode).

C++ documentation:

determines the way visibility of child widgets are handled.

The default value is StackOne. Setting the property to StackAll allows you to make use of the layout for overlay widgets that do additional drawing on top of other widgets, for example, graphical editors.

This property was introduced in Qt 4.4.

Access functions:

StackingMode stackingMode() const
void setStackingMode(StackingMode stackingMode)

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

Reimplemented from QLayoutItem::sizeHint().

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

C++ documentation:

Reimplemented from QLayoutItem::sizeHint().

pub unsafe fn stacking_mode(&self) -> StackingMode[src]

determines the way visibility of child widgets are handled.

Calls C++ function: QStackedLayout::StackingMode QStackedLayout::stackingMode() const.

C++ documentation:

determines the way visibility of child widgets are handled.

The default value is StackOne. Setting the property to StackAll allows you to make use of the layout for overlay widgets that do additional drawing on top of other widgets, for example, graphical editors.

This property was introduced in Qt 4.4.

Access functions:

StackingMode stackingMode() const
void setStackingMode(StackingMode stackingMode)

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn take_at(&self, arg1: c_int) -> Ptr<QLayoutItem>[src]

Reimplemented from QLayout::takeAt().

Calls C++ function: virtual QLayoutItem* QStackedLayout::takeAt(int arg1).

C++ documentation:

Reimplemented from QLayout::takeAt().

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QStackedLayout::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QStackedLayout::trUtf8(const char* s, const char* c, int n).

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

Returns the widget at the given index, or 0 if there is no widget at the given position.

Calls C++ function: QWidget* QStackedLayout::widget(int arg1) const.

C++ documentation:

Returns the widget at the given index, or 0 if there is no widget at the given position.

See also currentWidget() and indexOf().

Methods from Deref<Target = QLayout>

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

Redoes the layout for parentWidget() if necessary.

Calls C++ function: bool QLayout::activate().

C++ documentation:

Redoes the layout for parentWidget() if necessary.

You should generally not need to call this because it is automatically called at the most appropriate times. It returns true if the layout was redone.

See also update() and QWidget::updateGeometry().

pub unsafe fn add_item(&self, arg1: impl CastInto<Ptr<QLayoutItem>>)[src]

Implemented in subclasses to add an item. How it is added is specific to each subclass.

Calls C++ function: pure virtual void QLayout::addItem(QLayoutItem* arg1).

C++ documentation:

Implemented in subclasses to add an item. How it is added is specific to each subclass.

This function is not usually called in application code. To add a widget to a layout, use the addWidget() function; to add a child layout, use the addLayout() function provided by the relevant QLayout subclass.

Note: The ownership of item is transferred to the layout, and it's the layout's responsibility to delete it.

See also addWidget(), QBoxLayout::addLayout(), and QGridLayout::addLayout().

pub unsafe fn add_widget(&self, w: impl CastInto<Ptr<QWidget>>)[src]

Adds widget w to this layout in a manner specific to the layout. This function uses addItem().

Calls C++ function: void QLayout::addWidget(QWidget* w).

C++ documentation:

Adds widget w to this layout in a manner specific to the layout. This function uses addItem().

pub unsafe fn contents_margins(&self) -> CppBox<QMargins>[src]

Returns the margins used around the layout.

Calls C++ function: QMargins QLayout::contentsMargins() const.

C++ documentation:

Returns the margins used around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.6.

See also setContentsMargins().

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

Returns the layout's geometry() rectangle, but taking into account the contents margins.

Calls C++ function: QRect QLayout::contentsRect() const.

C++ documentation:

Returns the layout's geometry() rectangle, but taking into account the contents margins.

This function was introduced in Qt 4.3.

See also setContentsMargins() and getContentsMargins().

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

Reimplemented from QLayoutItem::controlTypes().

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

C++ documentation:

Reimplemented from QLayoutItem::controlTypes().

pub unsafe fn count(&self) -> c_int[src]

Must be implemented in subclasses to return the number of items in the layout.

Calls C++ function: pure virtual int QLayout::count() const.

C++ documentation:

Must be implemented in subclasses to return the number of items in the layout.

See also itemAt().

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

Reimplemented from QLayoutItem::expandingDirections().

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

C++ documentation:

Reimplemented from QLayoutItem::expandingDirections().

Returns whether this layout 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.

The default implementation returns Qt::Horizontal | Qt::Vertical. Subclasses reimplement it to return a meaningful value based on their child widgets's size policies.

See also sizeHint().

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

Reimplemented from QLayoutItem::geometry().

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

C++ documentation:

Reimplemented from QLayoutItem::geometry().

See also setGeometry().

pub unsafe fn get_contents_margins(
    &self,
    left: *mut c_int,
    top: *mut c_int,
    right: *mut c_int,
    bottom: *mut c_int
)
[src]

Extracts the left, top, right, and bottom margins used around the layout, and assigns them to *left, *top, *right, and *bottom (unless they are null pointers).

Calls C++ function: void QLayout::getContentsMargins(int* left, int* top, int* right, int* bottom) const.

C++ documentation:

Extracts the left, top, right, and bottom margins used around the layout, and assigns them to *left, *top, *right, and *bottom (unless they are null pointers).

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.3.

See also setContentsMargins(), QStyle::pixelMetric(), PM_LayoutLeftMargin, PM_LayoutTopMargin, PM_LayoutRightMargin, and PM_LayoutBottomMargin.

pub unsafe fn index_of_q_widget(
    &self,
    arg1: impl CastInto<Ptr<QWidget>>
) -> c_int
[src]

Searches for widget widget in this layout (not including child layouts).

Calls C++ function: virtual int QLayout::indexOf(QWidget* arg1) const.

C++ documentation:

Searches for widget widget in this layout (not including child layouts).

Returns the index of widget, or -1 if widget is not found.

The default implementation iterates over all items using itemAt()

pub unsafe fn index_of_q_layout_item(
    &self,
    arg1: impl CastInto<Ptr<QLayoutItem>>
) -> c_int
[src]

This is supported on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Searches for layout item layoutItem in this layout (not including child layouts).

Calls C++ function: int QLayout::indexOf(QLayoutItem* arg1) const.

C++ documentation:

Searches for layout item layoutItem in this layout (not including child layouts).

Returns the index of layoutItem, or -1 if layoutItem is not found.

This function was introduced in Qt 5.12.

pub unsafe fn invalidate(&self)[src]

Reimplemented from QLayoutItem::invalidate().

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

C++ documentation:

Reimplemented from QLayoutItem::invalidate().

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

Reimplemented from QLayoutItem::isEmpty().

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

C++ documentation:

Reimplemented from QLayoutItem::isEmpty().

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

Returns true if the layout is enabled; otherwise returns false.

Calls C++ function: bool QLayout::isEnabled() const.

C++ documentation:

Returns true if the layout is enabled; otherwise returns false.

See also setEnabled().

pub unsafe fn item_at(&self, index: c_int) -> Ptr<QLayoutItem>[src]

Must be implemented in subclasses to return the layout item at index. If there is no such item, the function must return 0. Items are numbered consecutively from 0. If an item is deleted, other items will be renumbered.

Calls C++ function: pure virtual QLayoutItem* QLayout::itemAt(int index) const.

C++ documentation:

Must be implemented in subclasses to return the layout item at index. If there is no such item, the function must return 0. Items are numbered consecutively from 0. If an item is deleted, other items will be renumbered.

This function can be used to iterate over a layout. The following code will draw a rectangle for each layout item in the layout structure of the widget.

static void paintLayout(QPainter painter, QLayoutItem item) { QLayout *layout = item->layout(); if (layout) { for (int i = 0; i < layout->count(); ++i) paintLayout(painter, layout->itemAt(i)); } painter->drawRect(item->geometry()); }

void MyWidget::paintEvent(QPaintEvent *) { QPainter painter(this); if (layout()) paintLayout(&painter, layout()); }

See also count() and takeAt().

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

Reimplemented from QLayoutItem::layout().

Calls C++ function: virtual QLayout* QLayout::layout().

C++ documentation:

Reimplemented from QLayoutItem::layout().

pub unsafe fn margin(&self) -> c_int[src]

This property holds the width of the outside border of the layout

Calls C++ function: int QLayout::margin() const.

C++ documentation:

This property holds the width of the outside border of the layout

Use setContentsMargins() and getContentsMargins() instead.

Access functions:

int margin() const
void setMargin(int margin)

See also contentsRect() and spacing.

Member Function Documentation

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

Reimplemented from QLayoutItem::maximumSize().

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

C++ documentation:

Reimplemented from QLayoutItem::maximumSize().

Returns the maximum size of this layout. This is the largest size that the layout can have while still respecting the specifications.

The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().

The default implementation allows unlimited resizing.

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

Returns the menu bar set for this layout, or 0 if no menu bar is set.

Calls C++ function: QWidget* QLayout::menuBar() const.

C++ documentation:

Returns the menu bar set for this layout, or 0 if no menu bar is set.

See also setMenuBar().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QLayout::metaObject() const.

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

Reimplemented from QLayoutItem::minimumSize().

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

C++ documentation:

Reimplemented from QLayoutItem::minimumSize().

Returns the minimum size of this layout. This is the smallest size that the layout can have while still respecting the specifications.

The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().

The default implementation allows unlimited resizing.

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

Returns the parent widget of this layout, or 0 if this layout is not installed on any widget.

Calls C++ function: QWidget* QLayout::parentWidget() const.

C++ documentation:

Returns the parent widget of this layout, or 0 if this layout is not installed on any widget.

If the layout is a sub-layout, this function returns the parent widget of the parent layout.

See also parent().

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QLayout::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QLayout::qt_metacast(const char* arg1).

pub unsafe fn remove_item(&self, arg1: impl CastInto<Ptr<QLayoutItem>>)[src]

Removes the layout item item from the layout. It is the caller's responsibility to delete the item.

Calls C++ function: void QLayout::removeItem(QLayoutItem* arg1).

C++ documentation:

Removes the layout item item from the layout. It is the caller's responsibility to delete the item.

Notice that item can be a layout (since QLayout inherits QLayoutItem).

See also removeWidget() and addItem().

pub unsafe fn remove_widget(&self, w: impl CastInto<Ptr<QWidget>>)[src]

Removes the widget widget from the layout. After this call, it is the caller's responsibility to give the widget a reasonable geometry or to put the widget back into a layout or to explicitly hide it if necessary.

Calls C++ function: void QLayout::removeWidget(QWidget* w).

C++ documentation:

Removes the widget widget from the layout. After this call, it is the caller's responsibility to give the widget a reasonable geometry or to put the widget back into a layout or to explicitly hide it if necessary.

Note: The ownership of widget remains the same as when it was added.

See also removeItem(), QWidget::setGeometry(), and addWidget().

pub unsafe fn replace_widget_3a(
    &self,
    from: impl CastInto<Ptr<QWidget>>,
    to: impl CastInto<Ptr<QWidget>>,
    options: QFlags<FindChildOption>
) -> Ptr<QLayoutItem>
[src]

Searches for widget from and replaces it with widget to if found. Returns the layout item that contains the widget from on success. Otherwise 0 is returned. If options contains Qt::FindChildrenRecursively (the default), sub-layouts are searched for doing the replacement. Any other flag in options is ignored.

Calls C++ function: QLayoutItem* QLayout::replaceWidget(QWidget* from, QWidget* to, QFlags<Qt::FindChildOption> options = …).

C++ documentation:

Searches for widget from and replaces it with widget to if found. Returns the layout item that contains the widget from on success. Otherwise 0 is returned. If options contains Qt::FindChildrenRecursively (the default), sub-layouts are searched for doing the replacement. Any other flag in options is ignored.

Notice that the returned item therefore might not belong to this layout, but to a sub-layout.

The returned layout item is no longer owned by the layout and should be either deleted or inserted to another layout. The widget from is no longer managed by the layout and may need to be deleted or hidden. The parent of widget from is left unchanged.

This function works for the built-in Qt layouts, but might not work for custom layouts.

This function was introduced in Qt 5.2.

See also indexOf().

pub unsafe fn replace_widget_2a(
    &self,
    from: impl CastInto<Ptr<QWidget>>,
    to: impl CastInto<Ptr<QWidget>>
) -> Ptr<QLayoutItem>
[src]

Searches for widget from and replaces it with widget to if found. Returns the layout item that contains the widget from on success. Otherwise 0 is returned. If options contains Qt::FindChildrenRecursively (the default), sub-layouts are searched for doing the replacement. Any other flag in options is ignored.

Calls C++ function: QLayoutItem* QLayout::replaceWidget(QWidget* from, QWidget* to).

C++ documentation:

Searches for widget from and replaces it with widget to if found. Returns the layout item that contains the widget from on success. Otherwise 0 is returned. If options contains Qt::FindChildrenRecursively (the default), sub-layouts are searched for doing the replacement. Any other flag in options is ignored.

Notice that the returned item therefore might not belong to this layout, but to a sub-layout.

The returned layout item is no longer owned by the layout and should be either deleted or inserted to another layout. The widget from is no longer managed by the layout and may need to be deleted or hidden. The parent of widget from is left unchanged.

This function works for the built-in Qt layouts, but might not work for custom layouts.

This function was introduced in Qt 5.2.

See also indexOf().

pub unsafe fn set_alignment_q_widget_q_flags_alignment_flag(
    &self,
    w: impl CastInto<Ptr<QWidget>>,
    alignment: QFlags<AlignmentFlag>
) -> bool
[src]

Sets the alignment for widget w to alignment and returns true if w is found in this layout (not including child layouts); otherwise returns false.

Calls C++ function: bool QLayout::setAlignment(QWidget* w, QFlags<Qt::AlignmentFlag> alignment).

C++ documentation:

Sets the alignment for widget w to alignment and returns true if w is found in this layout (not including child layouts); otherwise returns false.

pub unsafe fn set_alignment_q_layout_q_flags_alignment_flag(
    &self,
    l: impl CastInto<Ptr<QLayout>>,
    alignment: QFlags<AlignmentFlag>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QLayout::setAlignment(QLayout* l, QFlags<Qt::AlignmentFlag> alignment).

C++ documentation:

This is an overloaded function.

Sets the alignment for the layout l to alignment and returns true if l is found in this layout (not including child layouts); otherwise returns false.

pub unsafe fn set_contents_margins_4a(
    &self,
    left: c_int,
    top: c_int,
    right: c_int,
    bottom: c_int
)
[src]

Sets the left, top, right, and bottom margins to use around the layout.

Calls C++ function: void QLayout::setContentsMargins(int left, int top, int right, int bottom).

C++ documentation:

Sets the left, top, right, and bottom margins to use around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.3.

See also contentsMargins(), getContentsMargins(), QStyle::pixelMetric(), PM_LayoutLeftMargin, PM_LayoutTopMargin, PM_LayoutRightMargin, and PM_LayoutBottomMargin.

pub unsafe fn set_contents_margins_1a(
    &self,
    margins: impl CastInto<Ref<QMargins>>
)
[src]

Sets the margins to use around the layout.

Calls C++ function: void QLayout::setContentsMargins(const QMargins& margins).

C++ documentation:

Sets the margins to use around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.6.

See also contentsMargins().

pub unsafe fn set_enabled(&self, arg1: bool)[src]

Enables this layout if enable is true, otherwise disables it.

Calls C++ function: void QLayout::setEnabled(bool arg1).

C++ documentation:

Enables this layout if enable is true, otherwise disables it.

An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.

By default all layouts are enabled.

See also isEnabled().

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

Reimplemented from QLayoutItem::setGeometry().

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

C++ documentation:

Reimplemented from QLayoutItem::setGeometry().

See also geometry().

pub unsafe fn set_margin(&self, arg1: c_int)[src]

Note: Setter function for property margin.

Calls C++ function: void QLayout::setMargin(int arg1).

C++ documentation:

Note: Setter function for property margin.

See also margin().

pub unsafe fn set_menu_bar(&self, w: impl CastInto<Ptr<QWidget>>)[src]

Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins(). All child widgets are placed below the bottom edge of the menu bar.

Calls C++ function: void QLayout::setMenuBar(QWidget* w).

C++ documentation:

Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins(). All child widgets are placed below the bottom edge of the menu bar.

See also menuBar().

pub unsafe fn set_size_constraint(&self, arg1: SizeConstraint)[src]

This property holds the resize mode of the layout

Calls C++ function: void QLayout::setSizeConstraint(QLayout::SizeConstraint arg1).

C++ documentation:

This property holds the resize mode of the layout

The default mode is SetDefaultConstraint.

Access functions:

SizeConstraint sizeConstraint() const
void setSizeConstraint(SizeConstraint)

pub unsafe fn set_spacing(&self, arg1: c_int)[src]

This property holds the spacing between widgets inside the layout

Calls C++ function: void QLayout::setSpacing(int arg1).

C++ documentation:

This property holds the spacing between widgets inside the layout

If no value is explicitly set, the layout's spacing is inherited from the parent layout, or from the style settings for the parent widget.

For QGridLayout and QFormLayout, it is possible to set different horizontal and vertical spacings using setHorizontalSpacing() and setVerticalSpacing(). In that case, spacing() returns -1.

Access functions:

int spacing() const
void setSpacing(int)

See also contentsRect(), getContentsMargins(), QStyle::layoutSpacing(), and QStyle::pixelMetric().

pub unsafe fn size_constraint(&self) -> SizeConstraint[src]

This property holds the resize mode of the layout

Calls C++ function: QLayout::SizeConstraint QLayout::sizeConstraint() const.

C++ documentation:

This property holds the resize mode of the layout

The default mode is SetDefaultConstraint.

Access functions:

SizeConstraint sizeConstraint() const
void setSizeConstraint(SizeConstraint)

pub unsafe fn spacing(&self) -> c_int[src]

This property holds the spacing between widgets inside the layout

Calls C++ function: int QLayout::spacing() const.

C++ documentation:

This property holds the spacing between widgets inside the layout

If no value is explicitly set, the layout's spacing is inherited from the parent layout, or from the style settings for the parent widget.

For QGridLayout and QFormLayout, it is possible to set different horizontal and vertical spacings using setHorizontalSpacing() and setVerticalSpacing(). In that case, spacing() returns -1.

Access functions:

int spacing() const
void setSpacing(int)

See also contentsRect(), getContentsMargins(), QStyle::layoutSpacing(), and QStyle::pixelMetric().

pub unsafe fn take_at(&self, index: c_int) -> Ptr<QLayoutItem>[src]

Must be implemented in subclasses to remove the layout item at index from the layout, and return the item. If there is no such item, the function must do nothing and return 0. Items are numbered consecutively from 0. If an item is removed, other items will be renumbered.

Calls C++ function: pure virtual QLayoutItem* QLayout::takeAt(int index).

C++ documentation:

Must be implemented in subclasses to remove the layout item at index from the layout, and return the item. If there is no such item, the function must do nothing and return 0. Items are numbered consecutively from 0. If an item is removed, other items will be renumbered.

The following code fragment shows a safe way to remove all items from a layout:

QLayoutItem *child; while ((child = layout->takeAt(0)) != 0) { ... delete child; }

See also itemAt() and count().

pub unsafe fn total_height_for_width(&self, w: c_int) -> c_int[src]

Calls C++ function: int QLayout::totalHeightForWidth(int w) const.

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

Calls C++ function: QSize QLayout::totalMaximumSize() const.

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

Calls C++ function: QSize QLayout::totalMinimumSize() const.

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

Calls C++ function: QSize QLayout::totalSizeHint() const.

pub unsafe fn update(&self)[src]

Updates the layout for parentWidget().

Calls C++ function: void QLayout::update().

C++ documentation:

Updates the layout for parentWidget().

You should generally not need to call this because it is automatically called at the most appropriate times.

See also activate() and invalidate().

Trait Implementations

impl CppDeletable for QStackedLayout[src]

unsafe fn delete(&self)[src]

Destroys this QStackedLayout. Note that the layout's widgets are not destroyed.

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

C++ documentation:

Destroys this QStackedLayout. Note that the layout's widgets are not destroyed.

impl Deref for QStackedLayout[src]

type Target = QLayout

The resulting type after dereferencing.

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

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

impl DynamicCast<QStackedLayout> for QLayout[src]

unsafe fn dynamic_cast(ptr: Ptr<QLayout>) -> Ptr<QStackedLayout>[src]

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

impl DynamicCast<QStackedLayout> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QStackedLayout>[src]

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

impl DynamicCast<QStackedLayout> for QLayoutItem[src]

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

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

impl StaticDowncast<QStackedLayout> for QLayout[src]

unsafe fn static_downcast(ptr: Ptr<QLayout>) -> Ptr<QStackedLayout>[src]

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

impl StaticDowncast<QStackedLayout> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QStackedLayout>[src]

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

impl StaticDowncast<QStackedLayout> for QLayoutItem[src]

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

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

impl StaticUpcast<QLayout> for QStackedLayout[src]

unsafe fn static_upcast(ptr: Ptr<QStackedLayout>) -> Ptr<QLayout>[src]

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

impl StaticUpcast<QLayoutItem> for QStackedLayout[src]

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

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

impl StaticUpcast<QObject> for QStackedLayout[src]

unsafe fn static_upcast(ptr: Ptr<QStackedLayout>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QStackedLayout* 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.