Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos protegidos | Propiedades
Referencia de la Clase QGridView

The QGridView class provides an abstract base for fixed-size grids. Más...

#include <qgridview.h>

Diagrama de herencias de QGridView
QScrollView QScrollView QFrame QFrame QFrame QFrame QWidget QWidget QWidget QWidget QWidget QWidget QWidget QWidget QWellArray VDateInternalMonthPicker VDateTable QColorWell

Lista de todos los miembros.

Métodos públicos

 QGridView (QWidget *parent=0, const char *name=0, WFlags f=0)
 ~QGridView ()
int numRows () const
virtual void setNumRows (int)
int numCols () const
virtual void setNumCols (int)
int cellWidth () const
virtual void setCellWidth (int)
int cellHeight () const
virtual void setCellHeight (int)
QRect cellRect () const
QRect cellGeometry (int row, int column)
QSize gridSize () const
int rowAt (int y) const
int columnAt (int x) const
void repaintCell (int row, int column, bool erase=TRUE)
void updateCell (int row, int column)
void ensureCellVisible (int row, int column)
 QGridView (QWidget *parent=0, const char *name=0, WFlags f=0)
 ~QGridView ()
int numRows () const
virtual void setNumRows (int)
int numCols () const
virtual void setNumCols (int)
int cellWidth () const
virtual void setCellWidth (int)
int cellHeight () const
virtual void setCellHeight (int)
QRect cellRect () const
QRect cellGeometry (int row, int column)
QSize gridSize () const
int rowAt (int y) const
int columnAt (int x) const
void repaintCell (int row, int column, bool erase=TRUE)
void updateCell (int row, int column)
void ensureCellVisible (int row, int column)

Métodos protegidos

virtual void paintCell (QPainter *, int row, int col)=0
virtual void paintEmptyArea (QPainter *p, int cx, int cy, int cw, int ch)
void drawContents (QPainter *p, int cx, int cy, int cw, int ch)
virtual void dimensionChange (int, int)
virtual void paintCell (QPainter *, int row, int col)=0
virtual void paintEmptyArea (QPainter *p, int cx, int cy, int cw, int ch)
void drawContents (QPainter *p, int cx, int cy, int cw, int ch)
virtual void dimensionChange (int, int)

Propiedades

int numRows
 The number of rows in the grid.
int numCols
 The number of columns in the grid.
int cellWidth
 The width of a grid column.
int cellHeight
 The height of a grid row.

Descripción detallada

The QGridView class provides an abstract base for fixed-size grids.

A grid view consists of a number of abstract cells organized in rows and columns. The cells have a fixed size and are identified with a row index and a column index. The top-left cell is in row 0, column 0. The bottom-right cell is in row numRows()-1, column numCols()-1.

You can define numRows, numCols, cellWidth and cellHeight. Reimplement the pure virtual function paintCell() to draw the contents of a cell.

With ensureCellVisible(), you can ensure a certain cell is visible. With rowAt() and columnAt() you can find a cell based on the given x- and y-coordinates.

If you need to monitor changes to the grid's dimensions (i.e. when numRows or numCols is changed), reimplement the dimensionChange() change handler.

Note: the row and column indices are always given in the order, row (vertical offset) then column (horizontal offset). This order is the opposite of all pixel operations, which are given in the order x (horizontal offset), y (vertical offset).

QGridView is a very simple abstract class based on QScrollView. It is designed to simplify the task of drawing many cells of the same size in a potentially scrollable canvas. If you need rows and columns with different sizes, use a QTable instead. If you need a simple list of items, use a QListBox. If you need to present hierachical data use a QListView, and if you need random objects at random positions, consider using either a QIconView or a QCanvas.


Documentación del constructor y destructor

QGridView::QGridView ( QWidget parent = 0,
const char *  name = 0,
WFlags  f = 0 
)

Constructs a grid view.

The parent, name and widget flag, f, arguments are passed to the QScrollView constructor.

QGridView::~QGridView ( )

Destroys the grid view.

QGridView::QGridView ( QWidget parent = 0,
const char *  name = 0,
WFlags  f = 0 
)
QGridView::~QGridView ( )

Documentación de las funciones miembro

QRect QGridView::cellGeometry ( int  row,
int  column 
)

Returns the geometry of cell (row, column) in the content coordinate system.

Ver también:
cellRect()
QRect QGridView::cellGeometry ( int  row,
int  column 
)
int QGridView::cellHeight ( ) const
int QGridView::cellHeight ( ) const
QRect QGridView::cellRect ( ) const [inline]

Returns the geometry of a cell in a cell's coordinate system. This is a convenience function useful in paintCell(). It is equivalent to QRect( 0, 0, cellWidth(), cellHeight() ).

Ver también:
cellGeometry()
QRect QGridView::cellRect ( ) const
int QGridView::cellWidth ( ) const
int QGridView::cellWidth ( ) const
int QGridView::columnAt ( int  x) const
int QGridView::columnAt ( int  x) const [inline]

Returns the number of the column at position x. x must be given in content coordinates.

Ver también:
rowAt()
void QGridView::dimensionChange ( int  oldNumRows,
int  oldNumCols 
) [protected, virtual]

This change handler is called whenever any of the grid's dimensions change. oldNumRows and oldNumCols contain the old dimensions, numRows() and numCols() contain the new dimensions.

Reimplementado en QWellArray.

virtual void QGridView::dimensionChange ( int  ,
int   
) [protected, virtual]

Reimplementado en QWellArray.

void QGridView::drawContents ( QPainter p,
int  cx,
int  cy,
int  cw,
int  ch 
) [protected, virtual]

Reimplementado de QScrollView.

void QGridView::drawContents ( QPainter p,
int  clipx,
int  clipy,
int  clipw,
int  cliph 
) [protected, virtual]

Reimplement this function if you are viewing a drawing area rather than a widget.

The function should draw the rectangle (clipx, clipy, clipw, cliph) of the contents using painter p. The clip rectangle is in the scrollview's coordinates.

For example:

    {
        // Fill a 40000 by 50000 rectangle at (100000,150000)

        // Calculate the coordinates...
        int x1 = 100000, y1 = 150000;
        int x2 = x1+40000-1, y2 = y1+50000-1;

        // Clip the coordinates so X/Windows will not have problems...
        if (x1 < clipx) x1=clipx;
        if (y1 < clipy) y1=clipy;
        if (x2 > clipx+clipw-1) x2=clipx+clipw-1;
        if (y2 > clipy+cliph-1) y2=clipy+cliph-1;

        // Paint using the small coordinates...
        if ( x2 >= x1 && y2 >= y1 )
            p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red);
    }

The clip rectangle and translation of the painter p is already set appropriately.

Reimplementado de QScrollView.

void QGridView::ensureCellVisible ( int  row,
int  column 
)
void QGridView::ensureCellVisible ( int  row,
int  column 
)

Ensures cell (row, column) is visible, scrolling the grid view if necessary.

QSize QGridView::gridSize ( ) const [inline]

Returns the size of the grid in pixels.

QSize QGridView::gridSize ( ) const
int QGridView::numCols ( ) const
int QGridView::numCols ( ) const
int QGridView::numRows ( ) const
int QGridView::numRows ( ) const
virtual void QGridView::paintCell ( QPainter ,
int  row,
int  col 
) [protected, pure virtual]
void QGridView::paintCell ( QPainter p,
int  row,
int  col 
) [protected, pure virtual]

This pure virtual function is called to paint the single cell at (row, col) using painter p. The painter must be open when paintCell() is called and must remain open.

The coordinate system is translated so that the origin is at the top-left corner of the cell to be painted, i.e. cell coordinates. Do not scale or shear the coordinate system (or if you do, restore the transformation matrix before you return).

The painter is not clipped by default in order to get maximum efficiency. If you want clipping, use

    p->setClipRect( cellRect(), QPainter::CoordPainter );
    //... your drawing code
    p->setClipping( FALSE );

Implementado en VDateInternalMonthPicker, VDateTable y QWellArray.

void QGridView::paintEmptyArea ( QPainter p,
int  cx,
int  cy,
int  cw,
int  ch 
) [protected, virtual]

This function fills the cw pixels wide and ch pixels high rectangle starting at position (cx, cy) with the background color using the painter p.

paintEmptyArea() is invoked by drawContents() to erase or fill unused areas.

virtual void QGridView::paintEmptyArea ( QPainter p,
int  cx,
int  cy,
int  cw,
int  ch 
) [protected, virtual]
void QGridView::repaintCell ( int  row,
int  column,
bool  erase = TRUE 
)
void QGridView::repaintCell ( int  row,
int  column,
bool  erase = TRUE 
)

Repaints cell (row, column).

If erase is TRUE, Qt erases the area of the cell before the paintCell() call; otherwise no erasing takes place.

Ver también:
QWidget::repaint()
int QGridView::rowAt ( int  y) const
int QGridView::rowAt ( int  y) const [inline]

Returns the number of the row at position y. y must be given in content coordinates.

Ver también:
columnAt()
void QGridView::setCellHeight ( int  cellHeight) [virtual]
virtual void QGridView::setCellHeight ( int  ) [virtual]
virtual void QGridView::setCellWidth ( int  ) [virtual]
void QGridView::setCellWidth ( int  cellWidth) [virtual]
virtual void QGridView::setNumCols ( int  ) [virtual]
void QGridView::setNumCols ( int  numCols) [virtual]
virtual void QGridView::setNumRows ( int  ) [virtual]
void QGridView::setNumRows ( int  numRows) [virtual]
void QGridView::updateCell ( int  row,
int  column 
)
void QGridView::updateCell ( int  row,
int  column 
)

Updates cell (row, column).

Ver también:
QWidget::update()

Documentación de propiedades

int QGridView::cellHeight [inline, read, write]

The height of a grid row.

All rows in a grid view have the same height.

Ver también:
cellWidth
int QGridView::cellWidth [inline, read, write]

The width of a grid column.

All columns in a grid view have the same width.

Ver también:
cellHeight
int QGridView::numCols [inline, read, write]

The number of columns in the grid.

Ver también:
numRows
int QGridView::numRows [inline, read, write]

The number of rows in the grid.

Ver también:
numCols

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'