59# include <QtCore/qdebug.h>
73#ifdef QGRIDLAYOUTENGINE_DEBUG
74 void dump(
int indent)
const;
100 for (
int i =
count() - 1;
i >= 0; --
i) {
107 item->setParentLayoutItem(
nullptr);
108 if (
item->ownedByLayout())
119 int rowSpan,
int columnSpan, Qt::Alignment
alignment)
123 qWarning(
"QGraphicsGridLayout::addItem: invalid row/column: %d",
127 if (columnSpan < 1 || rowSpan < 1) {
128 qWarning(
"QGraphicsGridLayout::addItem: invalid row span/column span: %d",
129 rowSpan < 1 ? rowSpan : columnSpan);
133 qWarning(
"QGraphicsGridLayout::addItem: cannot add null item");
137 qWarning(
"QGraphicsGridLayout::addItem: cannot insert itself");
141 d->addChildLayoutItem(
item);
144 d->engine.insertItem(gridEngineItem, -1);
472 return d->engine.alignment(
item);
504 qWarning(
"QGraphicsGridLayout::itemAt: invalid row, column %d, %d",
row,
column);
508 return engineItem->layoutItem();
518 return d->engine.itemCount();
528 if (index < 0 || index >=
d->engine.itemCount()) {
529 qWarning(
"QGraphicsGridLayout::itemAt: invalid index %d",
index);
533 return engineItem->layoutItem();
546 if (index < 0 || index >=
d->engine.itemCount()) {
547 qWarning(
"QGraphicsGridLayout::removeAt: invalid index %d",
index);
554 d->engine.removeItem(gridItem);
558 const int oldCount =
d->engine.rowCount(orient);
559 if (gridItem->lastRow(orient) == oldCount - 1) {
560 const int newCount =
d->engine.effectiveLastRow(orient) + 1;
561 d->engine.removeRows(newCount, oldCount - newCount, orient);
588 d->engine.invalidate();
590 d->m_styleInfo->invalidate();
594#ifdef QGRIDLAYOUTENGINE_DEBUG
595void QGraphicsGridLayoutPrivate::dump(
int indent)
const
597 if (qt_graphicsLayoutDebug()) {
614 d->engine.setVisualDirection(visualDir);
618 d->engine.setGeometries(effectiveRect,
d->styleInfo());
619#ifdef QGRIDLAYOUTENGINE_DEBUG
620 if (qt_graphicsLayoutDebug()) {
622 qDebug(
"==== BEGIN DUMP OF QGraphicsGridLayout (%d)====",
counter++);
624 qDebug(
"==== END DUMP OF QGraphicsGridLayout ====");
638 return d->engine.sizeHint(which , constraint - extraMargins,
d->styleInfo()) + extraMargins;
644QRect QGraphicsGridLayout::cellRect(
int row,
int column,
int rowSpan,
int columnSpan)
const
651QSizePolicy::ControlTypes QGraphicsGridLayout::controlTypes(
LayoutSide side)
const
654 return d->engine.controlTypes(side);
QGraphicsGridLayoutEngine engine
QGraphicsLayoutStyleInfo * styleInfo() const
QGraphicsGridLayoutPrivate()
QScopedPointer< QGraphicsLayoutStyleInfo > m_styleInfo
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View.
void setRowFixedHeight(int row, qreal height)
Sets the fixed height for row, row, to height.
void setRowSpacing(int row, qreal spacing)
Sets the spacing for row to spacing.
void setHorizontalSpacing(qreal spacing)
Sets the default horizontal spacing for the grid layout to spacing.
Qt::Alignment rowAlignment(int row) const
Returns the alignment of row.
void setColumnMaximumWidth(int column, qreal width)
Sets the maximum width of column to width.
void setGeometry(const QRectF &rect) override
Sets the bounding geometry of the grid layout to rect.
int columnCount() const
Returns the number of columns in the grid layout.
qreal rowMinimumHeight(int row) const
Returns the minimum height for row, row.
void removeAt(int index) override
Removes the layout item at index without destroying it.
void setColumnMinimumWidth(int column, qreal width)
Sets the minimum width for column to width.
Qt::Alignment columnAlignment(int column) const
Returns the alignment for column.
qreal rowMaximumHeight(int row) const
Returns the maximum height for row, row.
int rowStretchFactor(int row) const
Returns the stretch factor for row.
void setRowMinimumHeight(int row, qreal height)
Sets the minimum height for row, row, to height.
void setColumnSpacing(int column, qreal spacing)
Sets the spacing for column to spacing.
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
Sets the alignment for item to alignment.
void invalidate() override
\reimp
void setColumnStretchFactor(int column, int stretch)
Sets the stretch factor for column to stretch.
void setVerticalSpacing(qreal spacing)
Sets the default vertical spacing for the grid layout to spacing.
void setRowMaximumHeight(int row, qreal height)
Sets the maximum height for row, row, to height.
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment=Qt::Alignment())
Adds item to the grid on row and column.
void setRowPreferredHeight(int row, qreal height)
Sets the preferred height for row, row, to height.
virtual ~QGraphicsGridLayout()
Destroys the QGraphicsGridLayout object.
qreal columnPreferredWidth(int column) const
Returns the preferred width for column.
void setRowStretchFactor(int row, int stretch)
Sets the stretch factor for row to stretch.
QGraphicsLayoutItem * itemAt(int row, int column) const
Returns a pointer to the layout item at (row, column).
qreal columnMaximumWidth(int column) const
Returns the maximum width for column.
qreal rowSpacing(int row) const
Returns the row spacing for row.
void setColumnAlignment(int column, Qt::Alignment alignment)
Sets the alignment for column to alignment.
QGraphicsGridLayout(QGraphicsLayoutItem *parent=nullptr)
Constructs a QGraphicsGridLayout instance.
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const override
\reimp
Qt::Alignment alignment(QGraphicsLayoutItem *item) const
Returns the alignment for item.
void removeItem(QGraphicsLayoutItem *item)
Removes the layout item item without destroying it.
int columnStretchFactor(int column) const
Returns the stretch factor for column.
void setColumnPreferredWidth(int column, qreal width)
Sets the preferred width for column to width.
qreal columnMinimumWidth(int column) const
Returns the minimum width for column.
int rowCount() const
Returns the number of rows in the grid layout.
void setColumnFixedWidth(int column, qreal width)
Sets the fixed width of column to width.
void setSpacing(qreal spacing)
Sets the grid layout's default spacing, both vertical and horizontal, to spacing.
void setRowAlignment(int row, Qt::Alignment alignment)
Sets the alignment of row to alignment.
int count() const override
Returns the number of layout items in this grid layout.
qreal rowPreferredHeight(int row) const
Returns the preferred height for row, row.
qreal horizontalSpacing() const
Returns the default horizontal spacing for the grid layout.
qreal verticalSpacing() const
Returns the default vertical spacing for the grid layout.
qreal columnSpacing(int column) const
Returns the column spacing for column.
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
QRectF geometry() const
Returns the item's geometry (e.g., position and size) as a QRectF.
virtual void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
virtual void invalidate()
Clears any cached geometry and size hint information in the layout, and posts a \l{QEvent::LayoutRequ...
void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const override
\reimp
\inmodule QtCore\reentrant
constexpr void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
\inmodule QtCore\reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
Combined button and popup list for selecting options.
GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
static void layoutItem(QQuickItem *item, qreal y, qreal width)
static QString dump(const QByteArray &)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent