7#include <QtCore/private/qnumeric_p.h>
8#include <QtQml/qqmlinfo.h>
221 return d->orientation;
237 return d->engine.sizeHint(whichSizeHint,
QSizeF(),
d->styleInfo);
258 return d->m_layoutDirection;
264 if (
d->m_layoutDirection ==
dir)
266 d->m_layoutDirection =
dir;
268 emit layoutDirectionChanged();
288 d->engine.setStretchFactor(
item, stretchFactor, orient);
303 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::componentComplete()" <<
this <<
parent();
320 if (qobject_cast<QQuickLayout*>(par))
323 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::componentComplete(). COMPLETED" <<
this <<
parent();
363 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::invalidate()" <<
this <<
", invalidated:" <<
invalidated();
367 qCDebug(lcQuickLayouts) <<
"d->m_rearranging:" <<
d->m_rearranging;
368 if (
d->m_rearranging) {
369 d->m_invalidateAfterRearrange << childItem;
378 d->engine.invalidate();
380 qCDebug(lcQuickLayouts) <<
"calling QQuickLayout::invalidate();";
384 parentLayout->invalidate(
this);
385 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::invalidate() LEAVING" <<
this;
394 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::updateLayoutItems ENTERING" <<
this;
395 d->engine.deleteItems();
397 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::updateLayoutItems() LEAVING" <<
this;
409 return d->engine.itemCount();
416 d->engine.removeItem(gridItem);
417 d->engine.removeRows(
index, 1,
d->orientation);
425 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::itemDestroyed";
427 removeGridItem(gridItem);
439 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::itemVisibilityChanged()";
449 qCDebug(lcQuickLayouts) <<
"QQuickGridLayoutBase::rearrange" <<
d->m_recurRearrangeCounter <<
this;
451 --(
d->m_recurRearrangeCounter);
453 if (
d->m_recurRearrangeCounter++ == 2) {
456 qWarning() <<
"Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations.";
464 d->m_rearranging =
true;
467 d->engine.setVisualDirection(visualDir);
480 d->m_rearranging =
false;
482 for (
QQuickItem *invalid : std::as_const(
d->m_invalidateAfterRearrange))
484 d->m_invalidateAfterRearrange.clear();
646 return d->engine.uniformCellWidths();
656 emit uniformCellWidthsChanged();
680 return d->engine.uniformCellHeights();
690 emit uniformCellHeightsChanged();
698 int nextCellPos[2] = {0,0};
699 int &nextColumn = nextCellPos[0];
700 int &nextRow = nextCellPos[1];
703 const int flowOrientation =
flow();
704 int &flowColumn = nextCellPos[flowOrientation];
705 int &flowRow = nextCellPos[1 - flowOrientation];
709 flowBound = std::numeric_limits<int>::max();
725 int &columnSpan =
span[0];
726 int &rowSpan =
span[1];
729 if (
info->isRowSet() ||
info->isColumnSet()) {
744 if (gridSize.
width() >= 0 &&
info->column() >= gridSize.
width()) {
750 rowSpan =
info->rowSpan();
751 columnSpan =
info->columnSpan();
752 if (columnSpan < 1) {
756 }
else if (rowSpan < 1) {
761 hStretch =
info->horizontalStretchFactor();
762 if (hStretch >= 0 && !
info->fillWidth())
763 qmlWarning(
child) <<
"horizontalStretchFactor requires fillWidth to also be set to true";
764 vStretch =
info->verticalStretchFactor();
765 if (vStretch >= 0 && !
info->fillHeight())
766 qmlWarning(
child) <<
"verticalStretchFactor requires fillHeight to also be set to true";
771 const int sp =
span[flowOrientation];
793 bool cellAcceptsItem;
796 cellAcceptsItem = (flowColumn +
sp) <= flowBound;
799 for (
int rs = 0; cellAcceptsItem && rs < rowSpan; ++rs) {
800 for (
int cs = 0; cellAcceptsItem && cs < columnSpan; ++cs) {
801 if (
d->engine.itemAt(nextRow + rs, nextColumn + cs)) {
802 cellAcceptsItem =
false;
809 if (flowColumn == flowBound) {
895 Q_ASSERT(
d->engine.uniformCellWidths() ==
d->engine.uniformCellHeights());
896 return d->engine.uniformCellWidths();
902 Q_ASSERT(
d->engine.uniformCellWidths() ==
d->engine.uniformCellHeights());
908 emit uniformCellSizesChanged();
928 return d->engine.spacing(
d->orientation,
d->styleInfo);
958 bool fillWidth =
false;
959 bool fillHeight =
false;
962 hStretch =
info->horizontalStretchFactor();
963 vStretch =
info->verticalStretchFactor();
964 fillWidth =
info->fillWidth();
965 fillHeight =
info->fillHeight();
968 const int index =
d->engine.rowCount(
d->orientation);
969 d->engine.insertRow(
index,
d->orientation);
972 int gridColumn =
index;
974 qSwap(gridRow, gridColumn);
979 qmlWarning(
child) <<
"horizontalStretchFactor requires fillWidth to also be set to true";
984 qmlWarning(
child) <<
"verticalStretchFactor requires fillHeight to also be set to true";
993#include "moc_qquicklinearlayout_p.cpp"
QString objectName
the name of this object
\inmodule QtCore\reentrant
Qt::LayoutDirection layoutDirection
int itemCount() const override
void itemVisibilityChanged(QQuickItem *item) override
Qt::LayoutDirection effectiveLayoutDirection() const
QQuickItem * itemAt(int index) const override
QSizeF sizeHint(Qt::SizeHint whichSizeHint) const override
virtual void insertLayoutItems()
void setLayoutDirection(Qt::LayoutDirection dir)
Qt::Orientation orientation() const
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void rearrange(const QSizeF &size) override
void itemDestroyed(QQuickItem *item) override
QQuickGridLayoutBase()
Identical to \l GridLayout, but having only one row.
void setStretchFactor(QQuickItem *item, int stretchFactor, Qt::Orientation orient) override
void setAlignment(QQuickItem *item, Qt::Alignment align) override
void invalidate(QQuickItem *childItem=nullptr) override
void updateLayoutItems() override
void setOrientation(Qt::Orientation orientation)
QQuickGridLayout(QQuickItem *parent=nullptr)
void columnSpacingChanged()
void setColumns(int columns)
void setUniformCellHeights(bool uniformCellHeights)
FINALbool uniformCellHeights
void setUniformCellWidths(bool uniformCellWidths)
void insertLayoutItems() override
void setRowSpacing(qreal spacing)
void setColumnSpacing(qreal spacing)
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
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
qreal height
This property holds the height of this item.
void maybeSubscribeToBaseLineOffsetChanges(QQuickItem *item)
virtual void rearrange(const QSizeF &)
virtual void invalidate(QQuickItem *childItem=nullptr)
bool shouldIgnoreItem(QQuickItem *child) const
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 deactivateRecur()
QQuickLayout::deactivateRecur.
void insertLayoutItems() override
void setSpacing(qreal spacing)
QQuickLinearLayout(Qt::Orientation orientation, QQuickItem *parent=nullptr)
void setUniformCellSizes(bool uniformCellSizes)
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Combined button and popup list for selecting options.
#define qCDebug(category,...)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static void layoutItem(QQuickItem *item, qreal y, qreal width)
QQuickLayoutAttached * attachedLayoutObject(QQuickItem *item, bool create=true)
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
QFileInfo info(fileName)
[8]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent