86 #ifndef QT_NO_GRAPHICSVIEW 95 #include <QtCore/qdebug.h> 107 void dump(
int indent)
const;
134 for (
int i =
count() - 1; i >= 0; --i) {
153 int rowSpan,
int columnSpan, Qt::Alignment
alignment)
156 if (row < 0 || column < 0) {
157 qWarning(
"QGraphicsGridLayout::addItem: invalid row/column: %d",
158 row < 0 ? row : column);
161 if (columnSpan < 1 || rowSpan < 1) {
162 qWarning(
"QGraphicsGridLayout::addItem: invalid row span/column span: %d",
163 rowSpan < 1 ? rowSpan : columnSpan);
167 qWarning(
"QGraphicsGridLayout::addItem: cannot add null item");
171 qWarning(
"QGraphicsGridLayout::addItem: cannot insert itself");
175 d->addChildLayoutItem(item);
177 new QGridLayoutItem(&
d->engine, item, row, column, rowSpan, columnSpan, alignment);
495 d->engine.setAlignment(item, alignment);
505 return d->engine.alignment(item);
537 qWarning(
"QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column);
541 return item->layoutItem();
551 return d->engine.itemCount();
561 if (index < 0 || index >=
d->engine.itemCount()) {
562 qWarning(
"QGraphicsGridLayout::itemAt: invalid index %d", index);
567 item = gridItem->layoutItem();
580 if (index < 0 || index >=
d->engine.itemCount()) {
581 qWarning(
"QGraphicsGridLayout::removeAt: invalid index %d", index);
586 layoutItem->setParentLayoutItem(0);
587 d->engine.removeItem(gridItem);
593 const int oldCount =
d->engine.rowCount(orient);
594 if (gridItem->lastRow(orient) == oldCount - 1) {
595 const int newCount =
d->engine.effectiveLastRow(orient) + 1;
596 d->engine.removeRows(newCount, oldCount - newCount, orient);
619 int index =
d->engine.indexOf(item);
628 d->engine.invalidate();
636 engine.dump(indent + 1);
652 d->engine.setVisualDirection(visualDir);
655 effectiveRect.
adjust(+left, +top, -right, -bottom);
656 d->engine.setGeometries(
d->styleInfo(), effectiveRect);
659 static int counter = 0;
660 qDebug(
"==== BEGIN DUMP OF QGraphicsGridLayout (%d)====", counter++);
662 qDebug(
"==== END DUMP OF QGraphicsGridLayout ====");
675 const QSizeF extraMargins(left + right, top + bottom);
676 return d->engine.sizeHint(
d->styleInfo(), which , constraint - extraMargins) + extraMargins;
682 QRect QGraphicsGridLayout::cellRect(
int row,
int column,
int rowSpan,
int columnSpan)
const 689 QSizePolicy::ControlTypes QGraphicsGridLayout::controlTypes(
LayoutSide side)
const 692 return d->engine.controlTypes(side);
698 #endif //QT_NO_GRAPHICSVIEW QGraphicsGridLayout(QGraphicsLayoutItem *parent=0)
Constructs a QGraphicsGridLayout instance.
virtual void setGeometry(const QRectF &rect)
This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordi...
QLayoutStyleInfo styleInfo() const
#define QT_END_NAMESPACE
This macro expands to.
void setColumnStretchFactor(int column, int stretch)
Sets the stretch factor for column to stretch.
void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const
Reimplemented Function
qreal columnSpacing(int column) const
Returns the column spacing for column.
void setRowStretchFactor(int row, int stretch)
Sets the stretch factor for row to stretch.
void setSpacing(qreal spacing)
Sets the grid layout's default spacing, both vertical and horizontal, to spacing. ...
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
bool qt_graphicsLayoutDebug()
The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View...
qreal rowSpacing(int row) const
Returns the row spacing for row.
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
Sets the alignment for item to alignment.
void setParentLayoutItem(QGraphicsLayoutItem *parent)
Sets the parent of this QGraphicsLayoutItem to parent.
static QStyle * style()
Returns the application's style object.
qreal rowMaximumHeight(int row) const
Returns the maximum height for row, row.
qreal verticalSpacing() const
Returns the default vertical spacing for the grid layout.
Qt::Alignment columnAlignment(int column) const
Returns the alignment for column.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setColumnAlignment(int column, Qt::Alignment alignment)
Sets the alignment for column to alignment.
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment=0)
Adds item to the grid on row and column.
virtual void invalidate()
Clears any cached geometry and size hint information in the layout, and posts a LayoutRequest event t...
Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget)
Q_CORE_EXPORT void qDebug(const char *,...)
void dump(int indent) const
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. ...
qreal rowPreferredHeight(int row) const
Returns the preferred height for row, row.
Qt::Alignment rowAlignment(int row) const
Returns the alignment of row.
qreal columnMaximumWidth(int column) const
Returns the maximum width for column.
void setRowAlignment(int row, Qt::Alignment alignment)
Sets the alignment of row to alignment.
Q_CORE_EXPORT void qWarning(const char *,...)
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts...
void setVerticalSpacing(qreal spacing)
Sets the default vertical spacing for the grid layout to spacing.
qreal rowMinimumHeight(int row) const
Returns the minimum height for row, row.
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...
qreal columnMinimumWidth(int column) const
Returns the minimum width for column.
void setRowFixedHeight(int row, qreal height)
Sets the fixed height for row, row, to height.
int rowStretchFactor(int row) const
Returns the stretch factor for row.
qreal columnPreferredWidth(int column) const
Returns the preferred width for column.
void qSwap(T &value1, T &value2)
void setRowPreferredHeight(int row, qreal height)
Sets the preferred height for row, row, to height.
int count() const
Returns the number of layout items in this grid layout.
void setColumnFixedWidth(int column, qreal width)
Sets the fixed width of column to width.
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
Reimplemented Function
Qt::Alignment alignment(QGraphicsLayoutItem *item) const
Returns the alignment for item.
void setRowMinimumHeight(int row, qreal height)
Sets the minimum height for row, row, to height.
int columnStretchFactor(int column) const
Returns the stretch factor for column.
void setRowMaximumHeight(int row, qreal height)
Sets the maximum height for row, row, to height.
void removeItem(QGraphicsLayoutItem *item)
Removes the layout item item without destroying it.
QGraphicsGridLayoutPrivate()
void setGeometry(const QRectF &rect)
Sets the bounding geometry of the grid layout to rect.
void invalidate()
Reimplemented Function
void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setColumnMaximumWidth(int column, qreal width)
Sets the maximum width of column to width.
int columnCount() const
Returns the number of columns in the grid layout.
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.
The QRect class defines a rectangle in the plane using integer precision.
bool isWidget() const
Returns true if this item is a widget (i.
void setColumnSpacing(int column, qreal spacing)
Sets the spacing for column to spacing.
void removeAt(int index)
Removes the layout item at index without destroying it.
int rowCount() const
Returns the number of rows in the grid layout.
void setColumnMinimumWidth(int column, qreal width)
Sets the minimum width for column to width.
void setRowSpacing(int row, qreal spacing)
Sets the spacing for row to spacing.
qreal horizontalSpacing() const
Returns the default horizontal spacing for the grid layout.
QGraphicsLayoutItem * itemAt(int row, int column) const
Returns a pointer to the layout item at (row, column).
void setColumnPreferredWidth(int column, qreal width)
Sets the preferred width for column to width.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
void setHorizontalSpacing(qreal spacing)
Sets the default horizontal spacing for the grid layout to spacing.
virtual ~QGraphicsGridLayout()
Destroys the QGraphicsGridLayout object.
QGraphicsLayoutItem * parent