93#include <QtCore/qdebug.h>
175 for (
int i =
count() - 1;
i >= 0; --
i) {
182 item->setParentLayoutItem(
nullptr);
183 if (
item->ownedByLayout())
199 d->engine.transpose();
212 return d->orientation;
239 qWarning(
"QGraphicsLinearLayout::insertItem: cannot insert null item");
243 qWarning(
"QGraphicsLinearLayout::insertItem: cannot insert itself");
246 d->addChildLayoutItem(
item);
250 d->engine.insertRow(
index,
d->orientation);
252 d->engine.insertItem(gridEngineItem,
index);
266 d->engine.insertRow(
index,
d->orientation);
267 d->engine.setRowStretchFactor(
index, stretch,
d->orientation);
281 item->setParentLayoutItem(
nullptr);
282 d->removeGridItem(gridItem);
297 if (index < 0 || index >=
d->engine.itemCount()) {
298 qWarning(
"QGraphicsLinearLayout::removeAt: invalid index %d",
index);
305 d->removeGridItem(gridItem);
321 qWarning(
"QGraphicsLinearLayout::setSpacing: invalid spacing %g",
spacing);
337 return d->engine.spacing(
d->orientation,
d->styleInfo());
355 return d->engine.rowSpacing(
index,
d->orientation);
371 qWarning(
"QGraphicsLinearLayout::setStretchFactor: cannot assign"
372 " a stretch factor to a null item");
377 d->engine.setStretchFactor(
item, stretch,
d->orientation);
391 qWarning(
"QGraphicsLinearLayout::setStretchFactor: cannot return"
392 " a stretch factor for a null item");
395 return d->engine.stretchFactor(
item,
d->orientation);
426 return d->engine.alignment(
item);
430QSizePolicy::ControlTypes QGraphicsLinearLayout::controlTypes(
LayoutSide side)
const
432 return d->engine.controlTypes(side);
442 return d->engine.itemCount();
452 if (index < 0 || index >=
d->engine.itemCount()) {
453 qWarning(
"QGraphicsLinearLayout::itemAt: invalid index %d",
index);
458 item = gridItem->layoutItem();
473 d->engine.setVisualDirection(visualDir);
477#ifdef QGRIDLAYOUTENGINE_DEBUG
478 if (qt_graphicsLayoutDebug()) {
484 d->engine.setGeometries(effectiveRect,
d->styleInfo());
485#ifdef QGRIDLAYOUTENGINE_DEBUG
486 if (qt_graphicsLayoutDebug()) {
502 return d->engine.sizeHint(which , constraint - extraMargins,
d->styleInfo()) + extraMargins;
511 d->engine.invalidate();
513 d->m_styleInfo->invalidate();
522#ifdef QGRIDLAYOUTENGINE_DEBUG
523 if (qt_graphicsLayoutDebug()) {
525 qDebug(
"%*s%s layout", indent,
"",
527 d->engine.dump(indent + 1);
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
QGraphicsLinearLayoutPrivate(Qt::Orientation orientation)
QScopedPointer< QGraphicsLayoutStyleInfo > m_styleInfo
Qt::Orientation orientation
void fixIndex(int *index) const
int gridRow(int index) const
void removeGridItem(QGridLayoutItem *gridItem)
QGraphicsLayoutStyleInfo * styleInfo() const
int gridColumn(int index) const
QGraphicsGridLayoutEngine engine
The QGraphicsLinearLayout class provides a horizontal or vertical layout for managing widgets in Grap...
void removeItem(QGraphicsLayoutItem *item)
Removes item from the layout without destroying it.
Qt::Alignment alignment(QGraphicsLayoutItem *item) const
Returns the alignment for item.
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const override
\reimp
void setStretchFactor(QGraphicsLayoutItem *item, int stretch)
Sets the stretch factor for item to stretch.
qreal spacing() const
Returns the layout's spacing.
void setItemSpacing(int index, qreal spacing)
Sets the spacing after item at index to spacing.
void setOrientation(Qt::Orientation orientation)
Change the layout orientation to orientation.
void setSpacing(qreal spacing)
Sets the layout's spacing to spacing.
void removeAt(int index) override
Removes the item at index without destroying it.
QGraphicsLinearLayout(QGraphicsLayoutItem *parent=nullptr)
Constructs a QGraphicsLinearLayout instance using Qt::Horizontal orientation.
void setGeometry(const QRectF &rect) override
\reimp
void insertStretch(int index, int stretch=1)
Inserts a stretch of stretch at index, or before any item that is currently at index.
int stretchFactor(QGraphicsLayoutItem *item) const
Returns the stretch factor for item.
virtual ~QGraphicsLinearLayout()
Destroys the QGraphicsLinearLayout object.
void invalidate() override
\reimp
qreal itemSpacing(int index) const
Returns the spacing after item at index.
void insertItem(int index, QGraphicsLayoutItem *item)
Inserts item into the layout at index, or before any item that is currently at index.
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
Sets the alignment of item to alignment.
void dump(int indent=0) const
QGraphicsLayoutItem * itemAt(int index) const override
\reimp When iterating from 0 and up, it will return the items in the visual arranged order.
Qt::Orientation orientation() const
Returns the layout orientation.
int count() const override
\reimp
void removeItem(QGridLayoutItem *item)
int columnCount(Qt::Orientation orientation) const
void removeRows(int row, int count, Qt::Orientation orientation)
int rowCount(Qt::Orientation orientation) const
\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.
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.
constexpr const T & qMin(const T &a, const T &b)
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
static void layoutItem(QQuickItem *item, qreal y, qreal width)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent