43 for ( QList<QLayoutItem*>::const_iterator it =
itemList.constBegin();
44 it !=
itemList.constEnd(); ++it, index++ )
59 int margin,
int spacing ):
64 setSpacing( spacing );
75 setSpacing( spacing );
100 QLayout::invalidate();
226 QLayout::setGeometry( rect );
239 for ( QList<QLayoutItem*>::const_iterator it =
d_data->
itemList.constBegin();
242 ( *it )->setGeometry( itemGeometries[index] );
273 if ( rowWidth > width )
291 QVector<int> colWidth( numColumns );
302 colWidth[col] = qMax( colWidth[col],
306 int rowWidth = 2 * margin() + ( numColumns - 1 ) * spacing();
308 rowWidth += colWidth[col];
347 QList<QRect> itemGeometries;
348 if ( numColumns == 0 ||
isEmpty() )
349 return itemGeometries;
356 return itemGeometries;
358 QVector<int> rowHeight( numRows );
359 QVector<int> colWidth( numColumns );
361 layoutGrid( numColumns, rowHeight, colWidth );
363 bool expandH, expandV;
367 if ( expandH || expandV )
368 stretchGrid( rect, numColumns, rowHeight, colWidth );
372 const QRect alignedRect = alignmentRect( rect );
375 const int xOffset = expandH ? 0 : alignedRect.x();
376 const int yOffset = expandV ? 0 : alignedRect.y();
378 QVector<int> colX( numColumns );
379 QVector<int> rowY( numRows );
381 const int xySpace = spacing();
383 rowY[0] = yOffset + margin();
384 for ( uint r = 1; r <
numRows; r++ )
385 rowY[r] = rowY[r-1] + rowHeight[r-1] + xySpace;
387 colX[0] = xOffset + margin();
389 colX[c] = colX[c-1] + colWidth[c-1] + xySpace;
392 #if QT_VERSION >= 0x040700 393 itemGeometries.reserve( itemCount );
401 const QRect itemGeometry( colX[col], rowY[row],
402 colWidth[col], rowHeight[row] );
403 itemGeometries.append( itemGeometry );
406 return itemGeometries;
420 QVector<int>& rowHeight, QVector<int>& colWidth )
const 422 if ( numColumns <= 0 )
435 rowHeight[row] = ( col == 0 )
436 ? size.height() : qMax( rowHeight[row], size.height() );
437 colWidth[col] = ( row == 0 )
438 ? size.width() : qMax( colWidth[col], size.width() );
465 QVector<int> rowHeight( numRows );
466 QVector<int> colWidth( numColumns );
468 layoutGrid( numColumns, rowHeight, colWidth );
470 int h = 2 * margin() + ( numRows - 1 ) * spacing();
471 for ( uint row = 0; row <
numRows; row++ )
490 uint
numColumns, QVector<int>& rowHeight, QVector<int>& colWidth )
const 492 if ( numColumns == 0 ||
isEmpty() )
495 bool expandH, expandV;
501 int xDelta = rect.width() - 2 * margin() - ( numColumns - 1 ) * spacing();
503 xDelta -= colWidth[col];
509 const int space = xDelta / ( numColumns - col );
510 colWidth[col] += space;
522 int yDelta = rect.height() - 2 * margin() - ( numRows - 1 ) * spacing();
523 for ( uint row = 0; row <
numRows; row++ )
524 yDelta -= rowHeight[row];
528 for ( uint row = 0; row <
numRows; row++ )
530 const int space = yDelta / ( numRows - row );
531 rowHeight[row] += space;
559 QVector<int> rowHeight( numRows );
560 QVector<int> colWidth( numColumns );
562 layoutGrid( numColumns, rowHeight, colWidth );
564 int h = 2 * margin() + ( numRows - 1 ) * spacing();
565 for ( uint row = 0; row <
numRows; row++ )
568 int w = 2 * margin() + ( numColumns - 1 ) * spacing();
572 return QSize( w, h );
virtual int heightForWidth(int) const
void layoutGrid(uint numCols, QVector< int > &rowHeight, QVector< int > &colWidth) const
virtual int maxItemWidth() const
virtual void setGeometry(const QRect &rect)
Qt::Orientations expanding
virtual uint columnsForWidth(int width) const
Calculate the number of columns for a given width.
QwtDynGridLayout(QWidget *, int margin=0, int space=-1)
void stretchGrid(const QRect &rect, uint numCols, QVector< int > &rowHeight, QVector< int > &colWidth) const
virtual void addItem(QLayoutItem *)
Add an item to the next free position.
int maxRowWidth(int numCols) const
virtual void invalidate()
Invalidate all internal caches.
virtual bool isEmpty() const
void setMaxColumns(uint maxCols)
virtual int count() const
virtual QLayoutItem * itemAt(int index) const
virtual Qt::Orientations expandingDirections() const
Returns whether this layout can make use of more space than sizeHint().
QList< QLayoutItem * > itemList
TFSIMD_FORCE_INLINE const tfScalar & w() const
virtual bool hasHeightForWidth() const
QList< QRect > layoutItems(const QRect &, uint numCols) const
uint maxColumns() const
Return the upper limit for the number of columns.
QVector< QSize > itemSizeHints
virtual ~QwtDynGridLayout()
Destructor.
virtual QLayoutItem * takeAt(int index)
void setExpandingDirections(Qt::Orientations)
virtual QSize sizeHint() const