QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtDynGridLayout类 参考

Dynamic grid layout that adjusts columns and rows to the current size 更多...

#include <qwt_dyngrid_layout.h>

类 QwtDynGridLayout 继承关系图:

class  PrivateData
 

Public 成员函数

 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 成员函数

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()).

构造及析构函数说明

◆ QwtDynGridLayout() [1/2]

QwtDynGridLayout::QwtDynGridLayout ( QWidget *  parent,
int  margin = 0,
int  spacing = -1 
)
explicit

Constructor with parent widget, margin and spacing

参数
[in]parentParent widget
[in]marginMargin around the layout
[in]spacingSpacing between items

◆ QwtDynGridLayout() [2/2]

QwtDynGridLayout::QwtDynGridLayout ( int  spacing = -1)
explicit

Constructor with spacing only

参数
[in]spacingSpacing between items

◆ ~QwtDynGridLayout()

QwtDynGridLayout::~QwtDynGridLayout ( )
override

Destructor

Deletes all layout items and private data.

成员函数说明

◆ addItem()

void QwtDynGridLayout::addItem ( QLayoutItem *  item)
overridevirtual

Add an item to the next free position

参数
[in]itemLayout item to add

◆ columnsForWidth()

uint QwtDynGridLayout::columnsForWidth ( int  width) const
virtual

Calculate the number of columns for a given width

The calculation tries to use as many columns as possible, limited by maxColumns().

参数
[in]widthAvailable width for all columns
返回
Number of columns for the given width

◆ count()

int QwtDynGridLayout::count ( ) const
overridevirtual

Get the number of items in the layout

返回
Number of layout items

◆ expandingDirections()

Qt::Orientations QwtDynGridLayout::expandingDirections ( ) const
overridevirtual

Get the expanding directions for the layout

返回
Orientations where the layout expands

◆ hasHeightForWidth()

bool QwtDynGridLayout::hasHeightForWidth ( ) const
overridevirtual

Check if the layout has height for width

返回
true, indicating QwtDynGridLayout implements heightForWidth()

◆ heightForWidth()

int QwtDynGridLayout::heightForWidth ( int  width) const
overridevirtual

Get the preferred height for a given width

参数
[in]widthWidth to calculate height for
返回
Preferred height for the given width

◆ invalidate()

void QwtDynGridLayout::invalidate ( )
overridevirtual

Invalidate all internal caches

Marks the layout as dirty so it will recalculate on next layout operation.

◆ isEmpty()

bool QwtDynGridLayout::isEmpty ( ) const
overridevirtual

Check if the layout is empty

返回
true if the layout contains no items

◆ itemAt()

QLayoutItem * QwtDynGridLayout::itemAt ( int  index) const
overridevirtual

Get the item at a specific index

参数
[in]indexIndex of the item
返回
Item at the specified index, or nullptr if index is out of range

◆ itemCount()

uint QwtDynGridLayout::itemCount ( ) const

Get the number of layout items

返回
Number of items in the layout

◆ layoutGrid()

void QwtDynGridLayout::layoutGrid ( uint  numColumns,
QVector< int > &  rowHeight,
QVector< int > &  colWidth 
) const
protected

Calculate the dimensions for the columns and rows for a grid of numColumns columns.

参数
numColumnsNumber of columns.
rowHeightArray where to fill in the calculated row heights.
colWidthArray where to fill in the calculated column widths.

◆ layoutItems()

QList< QRect > QwtDynGridLayout::layoutItems ( const QRect &  rect,
uint  numColumns 
) const

Calculate the geometries of the layout items

参数
[in]rectRectangle where to place the items
[in]numColumnsNumber of columns
返回
List of item geometries

◆ maxColumns()

uint QwtDynGridLayout::maxColumns ( ) const

Get the upper limit for the number of columns

返回
Upper limit for the number of columns, 0 means unlimited

◆ maxItemWidth()

int QwtDynGridLayout::maxItemWidth ( ) const
virtual

Get the maximum width of all layout items

返回
Maximum width of all items

◆ numColumns()

uint QwtDynGridLayout::numColumns ( ) const

Get the number of columns in the current layout

警告
The number of columns might change whenever the geometry changes.
返回
Number of columns

◆ numRows()

uint QwtDynGridLayout::numRows ( ) const

Get the number of rows in the current layout

警告
The number of rows might change whenever the geometry changes.
返回
Number of rows

◆ setExpandingDirections()

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]expandingOr'd orientations

◆ setGeometry()

void QwtDynGridLayout::setGeometry ( const QRect &  rect)
overridevirtual

Set the geometry for the layout

Reorganizes columns and rows and resizes managed items within the rectangle.

参数
[in]rectLayout geometry

◆ setMaxColumns()

void QwtDynGridLayout::setMaxColumns ( uint  maxColumns)

Set the upper limit for the number of columns

参数
[in]maxColumnsUpper limit, 0 means unlimited

◆ sizeHint()

QSize QwtDynGridLayout::sizeHint ( ) const
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.

返回
Size hint

◆ stretchGrid()

void QwtDynGridLayout::stretchGrid ( const QRect &  rect,
uint  numColumns,
QVector< int > &  rowHeight,
QVector< 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.

参数
rectBounding rectangle
numColumnsNumber of columns
rowHeightArray to be filled with the calculated row heights
colWidthArray to be filled with the calculated column widths
参见
setExpanding(), expanding()

◆ takeAt()

QLayoutItem * QwtDynGridLayout::takeAt ( int  index)
overridevirtual

Remove and return the item at a specific index

参数
[in]indexIndex of the item to remove
返回
Removed item, or nullptr if index is out of range

该类的文档由以下文件生成: