Class overview   Alphabetical list   Annotated list   Header Files   Member List   Examples  

QdbtTableCell Class Reference


The QdbtTableCell class represents a cell in a QdbtTabular object. More...

#include <qdbttabcell.h>

List of all member functions.

Public Members

Protected Members


Detailed Description

The QdbtTableCell class represents a cell in a QdbtTabular object.

This class represents a cell of a QdbtTabular. A cell consists of a text (default the empty string) and a pixmap (default the null Pixmap).

The cell itself is not aware of its width and height, but can compute its preferred size given the font metrics that are used for the text.

The alignment of the pixmap with respect to the text can be controlled using setPixmapAlignment(). The alignment of the cell as a whole can be controlled using setAlignment().

Suppose you have table widget called tabular. To change some properties of the cell at location ( row, col) in this table use the following code:

  // create a local copy of the cell
  QdbtTableCell cell(*tabular->cell(row,col));

  // change some properties of the cell

  .
  .
  .

  // update the cell at (row,col) in the table
  tabular->changeCell(&cell,row,col);
  

Examples: Example1, Example2, Example3 and Example4.


Member Function Documentation

QdbtTableCell::QdbtTableCell()

Constructs a cell with the following properties:

QdbtTableCell::QdbtTableCell(const char *t, const QPixmap *p, const QColor &c, int a, bool e)

Constructs a cell with the following properties:

QdbtTableCell::~QdbtTableCell() [virtual]

Destroys the cell

void QdbtTableCell::setText(const char *text)

Set the text of the cell to text.

See also: text().

Examples: Example1, Example2, Example3 and Example4.

const char *QdbtTableCell::text() const

Returns the text string of the cell.

See also: setText().

void QdbtTableCell::setPixmap(const QPixmap *pixmap)

Set the pixmap of the cell to pixmap.

See also: pixmap().

Examples: Example1 and Example4.

const QPixmap &QdbtTableCell::pixmap() const

Returns the pixmap of the cell.

See also: setPixmap().

void QdbtTableCell::setColor(const QColor &color)

Sets the color of the text to color.

See also: color().

Examples: Example1.

const QColor &QdbtTableCell::color() const

Returns the color of the cell's text.

See also: setColor().

void QdbtTableCell::setBackground(const QColor &color)

Sets the color of the background of the cell.

If an invalid color is supplied (the default), then the background color of the table will be used.

See also: background().

Examples: Example4.

const QColor &QdbtTableCell::background() const

Returns the background color of the cell.

See also: setBackground().

void QdbtTableCell::setEditable(bool state)

Sets whether or not the cell may be edited by the application user.

If state is TRUE the cell may be edited.

If state is FALSE the cell may not be edited.

See also: isEditable().

Examples: Example1, Example3 and Example4.

bool QdbtTableCell::isEditable() const

Returns TRUE if the cell may be edited by the user.

See also: setEditable().

void QdbtTableCell::setSelectable(bool enable)

Sets whether or not the cell may be selected by the user.

If enable is TRUE the cell may be selected (highlighted or unhighlighted) by the user.

If enable is FALSE the cell can only be highlighted from within the application.

See also: isSelectable().

Examples: Example4.

bool QdbtTableCell::isSelectable() const

Returns TRUE if the cell is currently highlighted.

See also: setSelected().

void QdbtTableCell::setSelected(bool enable)

Sets whether or not the cell should be displayed as being selected.

If enable is TRUE the cell is highlighted (drawn in inverse).

If enable is FALSE the cell is unhighlighted (drawn normal).

See also: isSelected().

Examples: Example4.

bool QdbtTableCell::isSelected() const

Returns TRUE if the cell is currently highlighted.

See also: setSelected().

void QdbtTableCell::setAlignment(int alignment)

Set the alignment of the text-pixmap pair. Possible values are:

See also: alignment().

Examples: Example1, Example2 and Example4.

int QdbtTableCell::alignment() const

Returns the alignment of the text-pixmap pair.

See also: alignment().

void QdbtTableCell::setPixmapAlignment(int alignment)

Sets the alignment of the pixmap with respect to the text. Possible values are:

See also: pixmapAlignment().

Examples: Example1 and Example4.

int QdbtTableCell::pixmapAlignment() const

Returns the align of the pixmap with respect to the text. Possible values are: AlignLeft, AlignRight, AlignTop, AlignBottom.

See also: setPixmapAlignment().

int QdbtTableCell::widthHint(const QFontMetrics &fm) const [virtual]

Returns the preferred width of the cell. This is not the actual cell width, but the width that is required to fit both text and pixmap in the cell.

See also: heightHint().

int QdbtTableCell::heightHint(const QFontMetrics &fm) const [virtual]

Returns the preferred height of the cell. This is not the actual cell height, but the height that is required to fit both text and pixmap in the cell.

See also: widthHint().

void QdbtTableCell::paint(QPainter *p, int w, int h, bool rowSelected, bool selectByRow, bool editing, int focusBar) [protected, virtual]

This function is called whenever the cell needs to be repainted. The width of the cell is w and the height is h. The painter p automatically clips against the area of the cell. The boolean rowSelected indicates if the row, that this cell belongs to, is selected. This should only have an effect if selectByRow is TRUE. The boolean editing indicates if the cell is currently being edited. The focusBar argument specify the the type of focus that needs to be drawn. Possible values are

QRect QdbtTableCell::getTextArea() const [protected, virtual]

Returns the area inside the cell, where the text is being drawn. The coordinates of the rectangle are in pixels and relative to the cell. The top left of the cell has coordinates (0,0).

QRect QdbtTableCell::getEditArea(int width) const [protected, virtual]

Returns the area inside the cell, where the edit focus may be placed. The coordinates of the rectangle are in pixels and relative to the cell. The top left of the cell has coordinates (0,0).


This file was generated from the following files:
Generated at 21:52, 1998/03/04 for QdbtTabular by doxygen  written by Dimitri van Heesch, © 1997-1998