Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

QwtDynGridLayout Class Reference

List of all members.

Detailed Description

The QwtDynGridLayout class lays out widgets in a grid, adjusting the number of 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 maxCols()).

Definition at line 30 of file qwt_dyngrid_layout.h.

Public Member Functions

 QwtDynGridLayout (QWidget *, int margin=0, int space=-1, const char *name=0)
 QwtDynGridLayout (QLayout *, int space=-1, const char *name=0)
 QwtDynGridLayout (int space=-1, const char *name=0)
virtual ~QwtDynGridLayout ()
virtual void invalidate ()
void setMaxCols (uint maxCols)
uint maxCols () const
uint numRows () const
uint numCols () const
virtual void addItem (QLayoutItem *)
virtual QLayoutIterator iterator ()
virtual int maxItemWidth () const
virtual void setGeometry (const QRect &rect)
virtual bool hasHeightForWidth () const
virtual int heightForWidth (int) const
virtual QSize sizeHint () const
void setExpanding (QSizePolicy::ExpandData)
virtual QSizePolicy::ExpandData expanding () const
virtual bool isEmpty () const
uint itemCount () const
virtual uint columnsForWidth (int width) const
QValueList< QRect > layoutItems (const QRect &, uint numCols) 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


Constructor & Destructor Documentation

QwtDynGridLayout::QwtDynGridLayout QWidget *  parent,
int  margin = 0,
int  space = -1,
const char *  name = 0
 

Parameters:
parent Parent widget
margin Margin
space Spacing
name Widget name

Definition at line 79 of file qwt_dyngrid_layout.cpp.

QwtDynGridLayout::QwtDynGridLayout QLayout *  parent,
int  space = -1,
const char *  name = 0
 

Parameters:
parent Parent widget
space Spacing
name Widget name

Definition at line 92 of file qwt_dyngrid_layout.cpp.

QwtDynGridLayout::QwtDynGridLayout int  space = -1,
const char *  name = 0
 

Parameters:
space Spacing
name Widget name

Definition at line 104 of file qwt_dyngrid_layout.cpp.

QwtDynGridLayout::~QwtDynGridLayout  )  [virtual]
 

Destructor.

Definition at line 124 of file qwt_dyngrid_layout.cpp.


Member Function Documentation

void QwtDynGridLayout::addItem QLayoutItem *   )  [virtual]
 

Adds item to the next free position.

Definition at line 176 of file qwt_dyngrid_layout.cpp.

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

Parameters:
width Available width for all columns
See also:
QwtDynGridLayout::maxCols(), QwtDynGridLayout::setMaxCols()

Definition at line 252 of file qwt_dyngrid_layout.cpp.

References isEmpty(), itemCount(), maxCols(), and numCols().

Referenced by heightForWidth(), QwtPlot::printLegend(), and setGeometry().

QSizePolicy::ExpandData QwtDynGridLayout::expanding  )  const [virtual]
 

Returns whether this layout can make use of more space than sizeHint(). A value of Vertical or Horizontal means that it wants to grow in only one dimension, while BothDirections means that it wants to grow in both dimensions.

See also:
QwtDynGridLayout::setExpanding()

Definition at line 456 of file qwt_dyngrid_layout.cpp.

Referenced by layoutItems(), and stretchGrid().

bool QwtDynGridLayout::hasHeightForWidth  )  const [virtual]
 

Returns:
TRUE: QwtDynGridLayout implements heightForWidth.
See also:
QwtDynGridLayout::heightForWidth()

Definition at line 466 of file qwt_dyngrid_layout.cpp.

int QwtDynGridLayout::heightForWidth int  width  )  const [virtual]
 

Returns:
The preferred height for this layout, given the width w.
See also:
QwtDynGridLayout::hasHeightForWidth()

Definition at line 476 of file qwt_dyngrid_layout.cpp.

References columnsForWidth(), isEmpty(), itemCount(), layoutGrid(), numCols(), and numRows().

Referenced by QwtLegend::layoutContents().

bool QwtDynGridLayout::isEmpty  )  const [virtual]
 

Returns:
TRUE if this layout is empty.

Definition at line 186 of file qwt_dyngrid_layout.cpp.

Referenced by columnsForWidth(), heightForWidth(), layoutItems(), maxItemWidth(), setGeometry(), sizeHint(), and stretchGrid().

uint QwtDynGridLayout::itemCount  )  const
 

Returns:
number of layout items

Definition at line 195 of file qwt_dyngrid_layout.cpp.

Referenced by columnsForWidth(), heightForWidth(), layoutItems(), setGeometry(), sizeHint(), and stretchGrid().

QLayoutIterator QwtDynGridLayout::iterator  )  [virtual]
 

Returns:
An iterator over the children of this layout.

Definition at line 204 of file qwt_dyngrid_layout.cpp.

Referenced by QwtPlot::printLegend().

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.

Parameters:
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 411 of file qwt_dyngrid_layout.cpp.

Referenced by heightForWidth(), layoutItems(), and sizeHint().

QValueList< 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.

Parameters:
rect Rect where to place the items
numCols Number of columns
Returns:
item geometries

Definition at line 335 of file qwt_dyngrid_layout.cpp.

References d_maxCols, expanding(), isEmpty(), itemCount(), layoutGrid(), maxCols(), numRows(), and stretchGrid().

Referenced by QwtPlot::printLegend(), and setGeometry().

uint QwtDynGridLayout::maxCols  )  const
 

Return the upper limit for the number of columns. 0 means unlimited, what is the default.

See also:
QwtDynGridLayout::setMaxCols()

Definition at line 169 of file qwt_dyngrid_layout.cpp.

Referenced by columnsForWidth(), and layoutItems().

int QwtDynGridLayout::maxItemWidth  )  const [virtual]
 

Returns:
the maximum width of all layout items

Definition at line 308 of file qwt_dyngrid_layout.cpp.

References isEmpty().

Referenced by QwtLegend::layoutContents().

uint QwtDynGridLayout::numCols  )  const
 

Returns:
Number of columns of the current layout.
See also:
QwtDynGridLayout::numRows
Warning:
The number of columns might change whenever the geometry changes

Definition at line 606 of file qwt_dyngrid_layout.cpp.

Referenced by columnsForWidth(), heightForWidth(), and sizeHint().

uint QwtDynGridLayout::numRows  )  const
 

Returns:
Number of rows of the current layout.
See also:
QwtDynGridLayout::numCols
Warning:
The number of rows might change whenever the geometry changes

Definition at line 596 of file qwt_dyngrid_layout.cpp.

Referenced by heightForWidth(), layoutItems(), sizeHint(), and stretchGrid().

void QwtDynGridLayout::setExpanding QSizePolicy::ExpandData  expanding  ) 
 

Set whether this layout can make use of more space than sizeHint(). A value of Vertical or Horizontal means that it wants to grow in only one dimension, while BothDirections means that it wants to grow in both dimensions. The default value is NoDirection.

See also:
QwtDynGridLayout::expanding()

Definition at line 443 of file qwt_dyngrid_layout.cpp.

void QwtDynGridLayout::setGeometry const QRect &  rect  )  [virtual]
 

Reorganizes columns and rows and resizes managed widgets within the rectangle rect.

Definition at line 215 of file qwt_dyngrid_layout.cpp.

References columnsForWidth(), isEmpty(), itemCount(), and layoutItems().

void QwtDynGridLayout::setMaxCols uint  maxCols  ) 
 

Limit the number of columns.

Parameters:
maxCols upper limit, 0 means unlimited
See also:
QwtDynGridLayout::maxCols()

Definition at line 158 of file qwt_dyngrid_layout.cpp.

Referenced by QwtPlot::setLegendPosition().

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.

See also:
QwtDynGridLayout::maxCols(), QwtDynGridLayout::setMaxCols()

Definition at line 565 of file qwt_dyngrid_layout.cpp.

References isEmpty(), itemCount(), layoutGrid(), numCols(), and numRows().

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.

See also:
QwtDynGridLayout::setExpanding(), QwtDynGridLayout::expanding()

Definition at line 505 of file qwt_dyngrid_layout.cpp.

References expanding(), isEmpty(), itemCount(), and numRows().

Referenced by layoutItems().


Generated on Sun Nov 21 11:12:50 2004 for Qwt User's Guide by doxygen 1.3.5