The QdbtTableCell class represents a cell in a QdbtTabular object. More...
#include <qdbttabcell.h>
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.
Constructs a cell with the following properties:
Constructs a cell with the following properties:
AlignLeft
, AlignRight
and AlignCenter
.
[virtual]
Destroys the cell
Set the text of the cell to text.
See also: text().
Examples: Example1, Example2, Example3 and Example4.
Returns the text string of the cell.
See also: setText().
Set the pixmap of the cell to pixmap.
See also: pixmap().
Examples: Example1 and Example4.
Returns the pixmap of the cell.
See also: setPixmap().
Sets the color of the text to color.
See also: color().
Examples: Example1.
Returns the color of the cell's text.
See also: setColor().
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.
Returns the background color of the cell.
See also: setBackground().
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.
Returns TRUE
if the cell may be edited by the user.
See also: setEditable().
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.
Returns TRUE
if the cell is currently highlighted.
See also: setSelected().
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.
Returns TRUE
if the cell is currently highlighted.
See also: setSelected().
Set the alignment of the text-pixmap pair. Possible values are:
AlignLeft
: The pixmap and text are aligned to the left.
AlignCenter
: The pixmap and text are centered.
AlignRight
: The pixmap and text are aligned to the right.
See also: alignment().
Examples: Example1, Example2 and Example4.
Returns the alignment of the text-pixmap pair.
See also: alignment().
Sets the alignment of the pixmap with respect to the text. Possible values are:
AlignLeft
: The pixmap is displayed to the left of the text.
AlignRight
: The pixmap is displayed to the right of the text.
AlignTop
: The pixmap is displayed above the text.
AlignBottom
: The pixmap is displayed below the text.
See also: pixmapAlignment().
Examples: Example1 and Example4.
Returns the align of the pixmap with respect to the text.
Possible values are: AlignLeft
, AlignRight
,
AlignTop
, AlignBottom
.
See also: setPixmapAlignment().
[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().
[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().
[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
Bar
: draws a focus around the cell
NoBar
: draw no focus.
[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).
[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).