QwtDynGridLayout takes the space it gets, divides it up into rows and columns, and puts each of the widgets it manages into the correct cell(s). It lays out as many number of columns as possible (limited by maxCols()).
Definition at line 32 of file qwt_dyngrid_layout.h.
Public Member Functions | |
QwtDynGridLayout (QWidget *, int margin=0, int space=-1) | |
QwtDynGridLayout (int space=-1) | |
virtual | ~QwtDynGridLayout () |
virtual void | invalidate () |
void | setMaxCols (uint maxCols) |
uint | maxCols () const |
uint | numRows () const |
uint | numCols () const |
virtual void | addItem (QLayoutItem *) |
virtual QLayoutItem * | itemAt (int index) const |
virtual QLayoutItem * | takeAt (int index) |
virtual int | count () const |
void | setExpandingDirections (Qt::Orientations) |
virtual Qt::Orientations | expandingDirections () const |
QList< QRect > | layoutItems (const QRect &, uint numCols) const |
virtual int | maxItemWidth () const |
virtual void | setGeometry (const QRect &rect) |
virtual bool | hasHeightForWidth () const |
virtual int | heightForWidth (int) const |
virtual QSize | sizeHint () const |
virtual bool | isEmpty () const |
uint | itemCount () const |
virtual uint | columnsForWidth (int width) const |
Protected Member Functions | |
void | layoutGrid (uint numCols, QwtArray< int > &rowHeight, QwtArray< int > &colWidth) const |
void | stretchGrid (const QRect &rect, uint numCols, QwtArray< int > &rowHeight, QwtArray< int > &colWidth) const |
QwtDynGridLayout::QwtDynGridLayout | ( | QWidget * | parent, | |
int | margin = 0 , |
|||
int | spacing = -1 | |||
) | [explicit] |
parent | Parent widget | |
margin | Margin | |
spacing | Spacing |
Definition at line 107 of file qwt_dyngrid_layout.cpp.
QwtDynGridLayout::QwtDynGridLayout | ( | int | spacing = -1 |
) | [explicit] |
QwtDynGridLayout::~QwtDynGridLayout | ( | ) | [virtual] |
void QwtDynGridLayout::setMaxCols | ( | uint | maxCols | ) |
Limit the number of columns.
maxCols | upper limit, 0 means unlimited |
Definition at line 194 of file qwt_dyngrid_layout.cpp.
uint QwtDynGridLayout::maxCols | ( | ) | const |
Return the upper limit for the number of columns. 0 means unlimited, what is the default.
Definition at line 205 of file qwt_dyngrid_layout.cpp.
Referenced by columnsForWidth().
uint QwtDynGridLayout::numRows | ( | ) | const |
Definition at line 678 of file qwt_dyngrid_layout.cpp.
Referenced by heightForWidth(), sizeHint(), and stretchGrid().
uint QwtDynGridLayout::numCols | ( | ) | const |
Definition at line 688 of file qwt_dyngrid_layout.cpp.
Referenced by columnsForWidth().
void QwtDynGridLayout::addItem | ( | QLayoutItem * | ) | [virtual] |
Adds item to the next free position.
Definition at line 212 of file qwt_dyngrid_layout.cpp.
References invalidate().
QList< QRect > QwtDynGridLayout::layoutItems | ( | const QRect & | rect, | |
uint | numCols | |||
) | const |
Calculate the geometries of the layout items for a layout with numCols columns and a given rect.
rect | Rect where to place the items | |
numCols | Number of columns |
Definition at line 440 of file qwt_dyngrid_layout.cpp.
References d_data.
Referenced by QwtPlot::printLegend(), and setGeometry().
int QwtDynGridLayout::maxItemWidth | ( | ) | const [virtual] |
Definition at line 409 of file qwt_dyngrid_layout.cpp.
References isEmpty().
void QwtDynGridLayout::setGeometry | ( | const QRect & | rect | ) | [virtual] |
Reorganizes columns and rows and resizes managed widgets within the rectangle rect.
Definition at line 314 of file qwt_dyngrid_layout.cpp.
References columnsForWidth(), isEmpty(), itemCount(), and layoutItems().
bool QwtDynGridLayout::hasHeightForWidth | ( | ) | const [virtual] |
Definition at line 547 of file qwt_dyngrid_layout.cpp.
int QwtDynGridLayout::heightForWidth | ( | int | width | ) | const [virtual] |
Definition at line 557 of file qwt_dyngrid_layout.cpp.
References columnsForWidth(), isEmpty(), itemCount(), layoutGrid(), and numRows().
QSize QwtDynGridLayout::sizeHint | ( | ) | const [virtual] |
Return the size hint. If maxCols() > 0 it is the size for a grid with maxCols() columns, otherwise it is the size for a grid with only one row.
Definition at line 647 of file qwt_dyngrid_layout.cpp.
References isEmpty(), itemCount(), layoutGrid(), and numRows().
bool QwtDynGridLayout::isEmpty | ( | ) | const [virtual] |
Definition at line 222 of file qwt_dyngrid_layout.cpp.
Referenced by columnsForWidth(), heightForWidth(), maxItemWidth(), setGeometry(), sizeHint(), and stretchGrid().
uint QwtDynGridLayout::itemCount | ( | ) | const |
Definition at line 231 of file qwt_dyngrid_layout.cpp.
Referenced by columnsForWidth(), heightForWidth(), setGeometry(), sizeHint(), and stretchGrid().
uint QwtDynGridLayout::columnsForWidth | ( | int | width | ) | const [virtual] |
Calculate the number of columns for a given width. It tries to use as many columns as possible (limited by maxCols())
width | Available width for all columns |
Definition at line 353 of file qwt_dyngrid_layout.cpp.
References isEmpty(), itemCount(), maxCols(), and numCols().
Referenced by heightForWidth(), QwtPlot::printLegend(), and setGeometry().
void QwtDynGridLayout::layoutGrid | ( | uint | numCols, | |
QwtArray< int > & | rowHeight, | |||
QwtArray< int > & | colWidth | |||
) | const [protected] |
Calculate the dimensions for the columns and rows for a grid of numCols columns.
numCols | Number of columns. | |
rowHeight | Array where to fill in the calculated row heights. | |
colWidth | Array where to fill in the calculated column widths. |
Definition at line 518 of file qwt_dyngrid_layout.cpp.
Referenced by heightForWidth(), and sizeHint().
void QwtDynGridLayout::stretchGrid | ( | const QRect & | rect, | |
uint | numCols, | |||
QwtArray< int > & | rowHeight, | |||
QwtArray< int > & | colWidth | |||
) | const [protected] |
Stretch columns in case of expanding() & QSizePolicy::Horizontal and rows in case of expanding() & QSizePolicy::Vertical to fill the entire rect. Rows and columns are stretched with the same factor.
Definition at line 586 of file qwt_dyngrid_layout.cpp.
References expandingDirections(), isEmpty(), itemCount(), and numRows().