Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickstacklayout.cpp File Reference

(0ec5680ab3365074b118fc299582516d469d1064)

#include "qquickstacklayout_p.h"
#include <limits>
#include <QtQml/qqmlinfo.h>
#include "moc_qquickstacklayout_p.cpp"
+ Include dependency graph for qquickstacklayout.cpp:

Go to the source code of this file.

Functions

static QT_BEGIN_NAMESPACE QQuickStackLayoutAttachedattachedStackLayoutObject (QQuickItem *item, bool create=false)
 The StackLayout class provides a stack of items where only one item is visible at a time.
 

Function Documentation

◆ attachedStackLayoutObject()

static QT_BEGIN_NAMESPACE QQuickStackLayoutAttached * attachedStackLayoutObject ( QQuickItem * item,
bool create = false )
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.

StackLayout {
anchors.fill: parent
currentIndex: 1
Rectangle {
color: 'teal'
implicitWidth: 200
implicitHeight: 200
}
Rectangle {
color: 'plum'
implicitWidth: 300
implicitHeight: 200
}
}
QQuickItem * fill
GLenum GLuint id
[7]
GLuint color
[2]
QQuickAnchors * anchors(QQuickItem *item)
QVBoxLayout * layout

Items in a StackLayout support these attached properties: \list

  • \l{Layout::minimumWidth}{Layout.minimumWidth}
  • \l{Layout::minimumHeight}{Layout.minimumHeight}
  • \l{Layout::preferredWidth}{Layout.preferredWidth}
  • \l{Layout::preferredHeight}{Layout.preferredHeight}
  • \l{Layout::maximumWidth}{Layout.maximumWidth}
  • \l{Layout::maximumHeight}{Layout.maximumHeight}
  • \l{Layout::fillWidth}{Layout.fillWidth}
  • \l{Layout::fillHeight}{Layout.fillHeight} \endlist

Read more about attached properties \l{QML Object Attributes}{here}.

See also
ColumnLayout
GridLayout
RowLayout
{QtQuick.Controls::StackView}{StackView}
{Qt Quick Layouts Overview}

Definition at line 74 of file qquickstacklayout.cpp.

References create(), and item.

Referenced by QQuickStackLayout::itemChange(), and QQuickStackLayout::setCurrentIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: