![]() |
Qt 6.x
The Qt SDK
|
#include "qquickstacklayout_p.h"
#include <limits>
#include <QtQml/qqmlinfo.h>
#include "moc_qquickstacklayout_p.cpp"
Go to the source code of this file.
Functions | |
static QT_BEGIN_NAMESPACE QQuickStackLayoutAttached * | attachedStackLayoutObject (QQuickItem *item, bool create=false) |
The StackLayout class provides a stack of items where only one item is visible at a time. | |
|
static |
The StackLayout class provides a stack of items where only one item is visible at a time.
\qmltype StackLayout
! \instantiates QQuickStackLayout \inherits Item \inqmlmodule QtQuick.Layouts
To be able to use this type more efficiently, it is recommended that you understand the general mechanism of the Qt Quick Layouts module. Refer to \l{Qt Quick Layouts Overview} for more information.
The current visible item can be modified by setting the \l currentIndex property. The index corresponds to the order of the StackLayout's children.
In contrast to most other layouts, child Items' \l{Layout::fillWidth}{Layout.fillWidth} and \l{Layout::fillHeight}{Layout.fillHeight} properties default to true
. As a consequence, child items are by default filled to match the size of the StackLayout as long as their \l{Layout::maximumWidth}{Layout.maximumWidth} or \l{Layout::maximumHeight}{Layout.maximumHeight} does not prevent it.
Items are added to the layout by reparenting the item to the layout. Similarly, removal is done by reparenting the item from the layout. Both of these operations will affect the layout's \l count property.
The following code will create a StackLayout where only the 'plum' rectangle is visible.
Items in a StackLayout support these attached properties: \list
Read more about attached properties \l{QML Object Attributes}{here}.
Definition at line 74 of file qquickstacklayout.cpp.
References create(), and item.
Referenced by QQuickStackLayout::itemChange(), and QQuickStackLayout::setCurrentIndex().