120 #ifndef QT_NO_GRAPHICSVIEW 129 #include <QtCore/qdebug.h> 210 for (
int i =
count() - 1; i >= 0; --i) {
233 if (orientation !=
d->orientation) {
234 d->engine.transpose();
247 return d->orientation;
277 qWarning(
"QGraphicsLinearLayout::insertItem: cannot insert null item");
281 qWarning(
"QGraphicsLinearLayout::insertItem: cannot insert itself");
284 d->addChildLayoutItem(item);
288 d->engine.insertRow(index,
d->orientation);
303 d->engine.insertRow(index,
d->orientation);
304 d->engine.setRowStretchFactor(index, stretch,
d->orientation);
319 d->removeGridItem(gridItem);
334 if (index < 0 || index >=
d->engine.itemCount()) {
335 qWarning(
"QGraphicsLinearLayout::removeAt: invalid index %d", index);
340 layoutItem->setParentLayoutItem(0);
341 d->removeGridItem(gridItem);
357 qWarning(
"QGraphicsLinearLayout::setSpacing: invalid spacing %g", spacing);
373 return d->engine.spacing(
d->styleInfo(),
d->orientation);
382 d->engine.setRowSpacing(index, spacing,
d->orientation);
391 return d->engine.rowSpacing(index,
d->orientation);
407 qWarning(
"QGraphicsLinearLayout::setStretchFactor: cannot assign" 408 " a stretch factor to a null item");
413 d->engine.setStretchFactor(item, stretch,
d->orientation);
427 qWarning(
"QGraphicsLinearLayout::setStretchFactor: cannot return" 428 " a stretch factor for a null item");
431 return d->engine.stretchFactor(item,
d->orientation);
445 d->engine.setAlignment(item, alignment);
462 return d->engine.alignment(item);
466 QSizePolicy::ControlTypes QGraphicsLinearLayout::controlTypes(
LayoutSide side)
const 468 return d->engine.controlTypes(side);
478 return d->engine.itemCount();
491 if (index < 0 || index >=
d->engine.itemCount()) {
492 qWarning(
"QGraphicsLinearLayout::itemAt: invalid index %d", index);
497 item = gridItem->layoutItem();
512 d->engine.setVisualDirection(visualDir);
515 effectiveRect.
adjust(+left, +top, -right, -bottom);
518 static int counter = 0;
519 qDebug() << counter++ <<
"QGraphicsLinearLayout::setGeometry - " << rect;
523 d->engine.setGeometries(
d->styleInfo(), effectiveRect);
540 const QSizeF extraMargins(left + right, top + bottom);
541 return d->engine.sizeHint(
d->styleInfo(), which , constraint - extraMargins) + extraMargins;
550 d->engine.invalidate();
562 qDebug(
"%*s%s layout", indent,
"",
564 d->engine.dump(indent + 1);
573 #endif //QT_NO_GRAPHICSVIEW
virtual void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const
Reimplemented Function
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
Sets the alignment of item to alignment.
Qt::Orientation orientation
void removeItem(QGridLayoutItem *item)
void setItemSpacing(int index, qreal spacing)
Sets the spacing after item at index to spacing.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
bool qt_graphicsLayoutDebug()
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
Reimplemented Function
void removeGridItem(QGridLayoutItem *gridItem)
void setStretchFactor(QGraphicsLayoutItem *item, int stretch)
Sets the stretch factor for item to stretch.
void setParentLayoutItem(QGraphicsLayoutItem *parent)
Sets the parent of this QGraphicsLayoutItem to parent.
static QStyle * style()
Returns the application's style object.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void insertStretch(int index, int stretch=1)
Inserts a stretch of stretch at index, or before any item that is currently at index.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
qreal itemSpacing(int index) const
Returns the spacing after item at index.
virtual void invalidate()
Clears any cached geometry and size hint information in the layout, and posts a LayoutRequest event t...
virtual ~QGraphicsLinearLayout()
Destroys the QGraphicsLinearLayout object.
Q_CORE_EXPORT void qDebug(const char *,...)
The QGraphicsLinearLayout class provides a horizontal or vertical layout for managing widgets in Grap...
QRectF geometry() const
Returns the item's geometry (e.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QGraphicsLinearLayout(QGraphicsLayoutItem *parent=0)
Constructs a QGraphicsLinearLayout instance using Qt::Horizontal orientation.
int gridColumn(int index) const
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
Q_CORE_EXPORT void qWarning(const char *,...)
void removeRows(int row, int count, Qt::Orientation orientation)
void fixIndex(int *index) const
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts...
int gridRow(int index) const
bool ownedByLayout() const
Returns whether a layout should delete this item in its destructor.
QGraphicsItem * parentItem() const
Returns the parent item of this layout, or 0 if this layout is not installed on any widget...
void setSpacing(qreal spacing)
Sets the layout's spacing to spacing.
void qSwap(T &value1, T &value2)
QGraphicsLayoutItem * itemAt(int index) const
When iterating from 0 and up, it will return the items in the visual arranged order.
QGraphicsLinearLayoutPrivate(Qt::Orientation orientation)
void invalidate()
Reimplemented Function
void removeItem(QGraphicsLayoutItem *item)
Removes item from the layout without destroying it.
qreal spacing() const
Returns the layout's spacing.
int columnCount(Qt::Orientation orientation) const
QLayoutStyleInfo styleInfo() const
void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
bool isWidget() const
Returns true if this item is a widget (i.
Qt::Orientation orientation() const
Returns the layout orientation.
void removeAt(int index)
Removes the item at index without destroying it.
void setGeometry(const QRectF &rect)
Reimplemented Function
Qt::Alignment alignment(QGraphicsLayoutItem *item) const
Returns the alignment for item.
void dump(int indent=0) const
int stretchFactor(QGraphicsLayoutItem *item) const
Returns the stretch factor for item.
int count() const
Reimplemented Function
void insertItem(int index, QGraphicsLayoutItem *item)
Inserts item into the layout at index, or before any item that is currently at index.
int rowCount(Qt::Orientation orientation) const
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QGraphicsLayoutItem * parent
void setOrientation(Qt::Orientation orientation)
Change the layout orientation to orientation.