8#include <QtQml/qqmlinfo.h>
77 qmlAttachedPropertiesObject<QQuickStackLayout>(
item,
create));
111 return d->currentIndex;
117 if (
index ==
d->currentIndex)
123 d->explicitCurrentIndex =
true;
127 next->setVisible(
true);
138 if (stackLayoutAttached)
139 stackLayoutAttached->setIsCurrentItem(
false);
143 if (stackLayoutAttached)
144 stackLayoutAttached->setIsCurrentItem(
true);
157 if (qobject_cast<QQuickLayout*>(par))
172 if (stackLayoutAttached) {
173 stackLayoutAttached->setLayout(
nullptr);
174 stackLayoutAttached->setIndex(-1);
175 stackLayoutAttached->setIsCurrentItem(
false);
178 childItemsChanged(AdjustCurrentIndex);
189 QSizeF &askingFor = m_cachedSizeHints[whichSizeHint];
197 maxS =
QSizeF(std::numeric_limits<qreal>::infinity(), std::numeric_limits<qreal>::infinity());
201 SizeHints &hints = cachedItemSizeHints(
i);
219 if (shouldIgnoreItem(
item))
221 if (childItem ==
item)
238 if (shouldIgnoreItem(
item))
252 if (shouldIgnoreItem(
item))
267 SizeHints &hints = m_cachedItemSizeHints[childItem];
274 m_cachedSizeHints[
i] =
QSizeF();
278 parentLayout->invalidate(
this);
281void QQuickStackLayout::childItemsChanged(AdjustCurrentIndexPolicy adjustCurrentIndexPolicy)
285 const int oldIndex =
d->currentIndex;
286 if (!
d->explicitCurrentIndex)
287 d->currentIndex = (
count > 0 ? 0 : -1);
289 if (adjustCurrentIndexPolicy == AdjustCurrentIndex) {
301 if (
d->currentIndex <
d->count) {
304 if (
child->isVisible()) {
311 if (
d->currentIndex != oldIndex)
321 child->setVisible(
d->currentIndex ==
i);
324 if (stackLayoutAttached) {
325 stackLayoutAttached->setLayout(
this);
326 stackLayoutAttached->setIndex(
i);
327 stackLayoutAttached->setIsCurrentItem(
d->currentIndex ==
i);
332QQuickStackLayout::SizeHints &QQuickStackLayout::cachedItemSizeHints(
int index)
const
336 SizeHints &hints = m_cachedItemSizeHints[
item];
337 if (!hints.min().isValid())
338 QQuickStackLayout::collectItemSizeHints(
item, hints.array);
349 qCDebug(lcQuickLayouts) <<
"QQuickStackLayout::rearrange";
351 if (
d->currentIndex == -1 ||
d->currentIndex >= m_cachedItemSizeHints.
size())
353 QQuickStackLayout::SizeHints &hints = cachedItemSizeHints(
d->currentIndex);
359 item->setSize(effectiveNewSize);
360 if (effectiveNewSize == oldSize)
375 if (
info->isFillWidthSet() && !
info->fillWidth()) {
381 if (
info->isFillHeightSet() && !
info->fillHeight()) {
397 childItemsChanged(AdjustCurrentIndex);
405 qmlWarning(
object) <<
"StackLayout must be attached to an Item";
409 auto stackLayout = qobject_cast<QQuickStackLayout*>(
item->
parentItem());
416 if (!stackLayout->isComponentComplete()) {
422 const int index = stackLayout->indexOf(
item);
430 stackLayout->childItemsChanged();
451 if (
index == m_index)
471 return m_isCurrentItem;
510#include "moc_qquickstacklayout_p.cpp"
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
bool remove(const Key &key)
Removes the item that has the key from the hash.
qsizetype size() const noexcept
Returns the number of items in the hash.
\inmodule QtCore\reentrant
static QQuickItemPrivate * get(QQuickItem *item)
bool isTransparentForPositioner() const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QList< QQuickItem * > childItems() const
Returns the children of this item.
qreal width
This property holds the width of this item.
QQuickItem * parentItem() const
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal height
This property holds the height of this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
static void effectiveSizeHints_helper(QQuickItem *item, QSizeF *cachedSizeHints, QQuickLayoutAttached **info, bool useFallbackToWidthOrHeight)
virtual void rearrange(const QSizeF &)
virtual void invalidate(QQuickItem *childItem=nullptr)
void checkAnchors(QQuickItem *item) const
void ensureLayoutItemsUpdated(EnsureLayoutItemsUpdatedOptions options={}) const
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void isCurrentItemChanged()
void setLayout(QQuickStackLayout *layout)
void setIsCurrentItem(bool isCurrentItem)
QQuickStackLayout * layout
QQuickStackLayoutAttached(QObject *object)
void setAlignment(QQuickItem *item, Qt::Alignment align) override
Q_INVOKABLE QQuickItem * itemAt(int index) const override
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
int indexOf(QQuickItem *item) const
void currentIndexChanged()
void setStretchFactor(QQuickItem *item, int stretchFactor, Qt::Orientation orient) override
friend class QQuickStackLayoutAttached
void rearrange(const QSizeF &) override
void invalidate(QQuickItem *childItem=nullptr) override
static QQuickStackLayoutAttached * qmlAttachedProperties(QObject *object)
QQuickStackLayout(QQuickItem *parent=nullptr)
void setCurrentIndex(int index)
void itemSiblingOrderChanged(QQuickItem *item) override
int itemCount() const override
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
QSizeF sizeHint(Qt::SizeHint whichSizeHint) const override
constexpr bool isValid() const noexcept
Returns true if both the width and height are equal to or greater than 0; otherwise returns false.
bool isNull() const noexcept
Returns true if both the width and height are 0.0 (ignoring the sign); otherwise returns false.
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
constexpr qreal width() const noexcept
Returns the width.
constexpr QSizeF expandedTo(const QSizeF &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr QSizeF boundedTo(const QSizeF &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr qreal height() const noexcept
Returns the height.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qCDebug(category,...)
GLenum GLenum GLsizei count
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
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.
QFileInfo info(fileName)
[8]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent