|
QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
|
Dynamic grid layout that adjusts columns and rows to the current size. More...
#include <qwt_dyngrid_layout.h>
Classes | |
| class | PrivateData |
Public Member Functions | |
| QwtDynGridLayout (QWidget *, int margin=0, int spacing=-1) | |
| Constructor with parent widget, margin and spacing. | |
| QwtDynGridLayout (int spacing=-1) | |
| Constructor with spacing only. | |
| ~QwtDynGridLayout () override | |
| Destructor. | |
| virtual void | invalidate () override |
| Invalidate all internal caches. | |
| void | setMaxColumns (uint maxColumns) |
| Set the upper limit for the number of columns. | |
| uint | maxColumns () const |
| Get the upper limit for the number of columns. | |
| uint | numRows () const |
| Get the number of rows in the current layout. | |
| uint | numColumns () const |
| Get the number of columns in the current layout. | |
| virtual void | addItem (QLayoutItem *) override |
| Add an item to the next free position. | |
| virtual QLayoutItem * | itemAt (int index) const override |
| Get the item at a specific index. | |
| virtual QLayoutItem * | takeAt (int index) override |
| Remove and return the item at a specific index. | |
| virtual int | count () const override |
| Get the number of items in the layout. | |
| void | setExpandingDirections (Qt::Orientations) |
| Set the expanding directions for the layout. | |
| virtual Qt::Orientations | expandingDirections () const override |
| Get the expanding directions for the layout. | |
| QList< QRect > | layoutItems (const QRect &, uint numColumns) const |
| Calculate the geometries of the layout items. | |
| virtual int | maxItemWidth () const |
| Get the maximum width of all layout items. | |
| virtual void | setGeometry (const QRect &) override |
| Set the geometry for the layout. | |
| virtual bool | hasHeightForWidth () const override |
| Check if the layout has height for width. | |
| virtual int | heightForWidth (int) const override |
| Get the preferred height for a given width. | |
| virtual QSize | sizeHint () const override |
| Get the size hint for the layout. | |
| virtual bool | isEmpty () const override |
| Check if the layout is empty. | |
| uint | itemCount () const |
| Get the number of layout items. | |
| virtual uint | columnsForWidth (int width) const |
| Calculate the number of columns for a given width. | |
Protected Member Functions | |
| void | layoutGrid (uint numColumns, QVector< int > &rowHeight, QVector< int > &colWidth) const |
| Calculate the dimensions for the columns and rows for a grid of numColumns columns. | |
| void | stretchGrid (const QRect &rect, uint numColumns, QVector< int > &rowHeight, QVector< int > &colWidth) const |
| Stretch columns in case of expanding() & QSizePolicy::Horizontal and rows in case of expanding() & QSizePolicy::Vertical to fill the entire rect. | |
Dynamic grid layout that adjusts columns and rows to the current size.
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 maxColumns()).
|
explicit |
Constructor with parent widget, margin and spacing.
| [in] | parent | Parent widget |
| [in] | margin | Margin around the layout |
| [in] | spacing | Spacing between items |
|
explicit |
Constructor with spacing only.
| [in] | spacing | Spacing between items |
|
override |
Destructor.
Deletes all layout items and private data.
|
overridevirtual |
Add an item to the next free position.
| [in] | item | Layout item to add |
|
virtual |
Calculate the number of columns for a given width.
The calculation tries to use as many columns as possible, limited by maxColumns().
| [in] | width | Available width for all columns |
|
overridevirtual |
Get the number of items in the layout.
|
overridevirtual |
Get the expanding directions for the layout.
|
overridevirtual |
Check if the layout has height for width.
|
overridevirtual |
Get the preferred height for a given width.
| [in] | width | Width to calculate height for |
|
overridevirtual |
Invalidate all internal caches.
Marks the layout as dirty so it will recalculate on next layout operation.
|
overridevirtual |
Check if the layout is empty.
|
overridevirtual |
Get the item at a specific index.
| [in] | index | Index of the item |
| uint QwtDynGridLayout::itemCount | ( | ) | const |
Get the number of layout items.
|
protected |
Calculate the dimensions for the columns and rows for a grid of numColumns columns.
| numColumns | Number of columns. |
| rowHeight | Array where to fill in the calculated row heights. |
| colWidth | Array where to fill in the calculated column widths. |
| QList< QRect > QwtDynGridLayout::layoutItems | ( | const QRect & | rect, |
| uint | numColumns | ||
| ) | const |
Calculate the geometries of the layout items.
| [in] | rect | Rectangle where to place the items |
| [in] | numColumns | Number of columns |
| uint QwtDynGridLayout::maxColumns | ( | ) | const |
Get the upper limit for the number of columns.
|
virtual |
Get the maximum width of all layout items.
| uint QwtDynGridLayout::numColumns | ( | ) | const |
Get the number of columns in the current layout.
| uint QwtDynGridLayout::numRows | ( | ) | const |
Get the number of rows in the current layout.
| void QwtDynGridLayout::setExpandingDirections | ( | Qt::Orientations | expanding | ) |
Set the expanding directions for the layout.
A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only one dimension, while Qt::Vertical | Qt::Horizontal means that it wants to grow in both dimensions.
| [in] | expanding | Or'd orientations |
|
overridevirtual |
Set the geometry for the layout.
Reorganizes columns and rows and resizes managed items within the rectangle.
| [in] | rect | Layout geometry |
| void QwtDynGridLayout::setMaxColumns | ( | uint | maxColumns | ) |
Set the upper limit for the number of columns.
| [in] | maxColumns | Upper limit, 0 means unlimited |
|
overridevirtual |
Get the size hint for the layout.
If maxColumns() > 0 it is the size for a grid with maxColumns() columns, otherwise it is the size for a grid with only one row.
|
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.
| rect | Bounding rectangle |
| numColumns | Number of columns |
| rowHeight | Array to be filled with the calculated row heights |
| colWidth | Array to be filled with the calculated column widths |
|
overridevirtual |
Remove and return the item at a specific index.
| [in] | index | Index of the item to remove |