Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Examples  

QdbtBorderlessComboCell Class Reference
[Cell implementations]

The QdbtComboCell class represents a cell in a QdbtTabular object that acts as a QComboBox and has no visible border. More...

#include <qdbtcombocell.h>

Inheritance diagram for QdbtBorderlessComboCell:

Inheritance graph
[legend]
Collaboration diagram for QdbtBorderlessComboCell:

Collaboration graph
[legend]
List of all members.

Public Types

enum  paintModifiers { NO_MODIF = 0x0000, SUPRESS_BORDER = 0x0001 }

Public Methods

 QdbtBorderlessComboCell ()
 QdbtBorderlessComboCell (const QdbtBorderlessComboCell &)
 QdbtBorderlessComboCell (int value, int align=Qt::AlignLeft)
virtual ~QdbtBorderlessComboCell ()
virtual int heightHint (const QFontMetrics &fm) const
virtual QString text () const
virtual int widthHint (const QFontMetrics &fm) const
void setValue (int value)
int value () const
void setAlignment (int alignment)
int alignment () const
virtual const QColor & color (QdbtBaseTabular *) const
virtual const QColor & background (QdbtBaseTabular *) const
virtual void setEditable (bool state)
bool isEditable () const
void rightButtonClicked (QdbtBaseTabular *tab, int row, int col) const

Protected Methods

virtual QdbtBaseCell * clone (QdbtBaseTabular *) const
virtual void paint (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool selected, bool editing=FALSE)
virtual void paintFocus (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool, bool=FALSE)
virtual QWidget * editor (QdbtBaseTabular *) const
virtual QRect getTextArea () const
virtual QRect getEditArea (int width) const
virtual bool beginEdit (QdbtBaseTabular *, int row, int col, const QRect cellGeometry) const
virtual bool acceptEdit (QdbtBaseTabular *, int row, int col)
virtual bool cancelEdit (QdbtBaseTabular *, int row, int col)
virtual bool mouseEvent (QdbtBaseTabular *, int row, int col, QMouseEvent *e, const QRect cellGeometry)
virtual bool keyEvent (QdbtBaseTabular *, int row, int col, QKeyEvent *e, const QRect cellGeometry)
virtual QStringList contentOfPopupMenu () const
void paintMethod (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool selected, bool editing=FALSE, int modif=NO_MODIF)
void paintFocusMethod (QPainter *p, QdbtBaseTabular *t, const QRect &r, bool, bool=FALSE, int modif=NO_MODIF)
virtual void setEditorEnabled (QdbtBaseTabular *, bool) const
virtual void moveEditor (QdbtBaseTabular *, const QRect cellGeometry) const
bool aboutToBeEdited (QdbtBaseTabular *) const
void notifyOnEditResult (QdbtBaseTabular *tab, int row, int col, int result, QString oldText)
QFont font (QdbtBaseTabular *) const
bool prepareEditor (QdbtBaseTabular *tab, const QRect &geom) const
bool cleanupEditor (QdbtBaseTabular *tab) const

Static Protected Attributes

int MASK_EDITABLE = 0x0001
int MASK_SELECTABLE = 0x0002
int MASK_SELECTED = 0x0004
int bw = 4

Detailed Description

The QdbtComboCell class represents a cell in a QdbtTabular object that acts as a QComboBox and has no visible border.

The cell's selection list is stored encapsulated into the virtual function contentOfPopupMenu(), that returns the list of all available choices as a list of strings.

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 text displayed in the combo box can be controlled using setAlignment().

Examples:

example4.cpp.


Member Enumeration Documentation

enum QdbtComboCell::paintModifiers [inherited]
 

Enum-Type for modifiers, that may be used to change the way, a cell is being painted.

Enumeration values:
NO_MODIF  No modifications are applied, the cells is painted in the normal way.
SUPRESS_BORDER  The cell is painted without borders surrounding it.


Constructor & Destructor Documentation

QdbtBorderlessComboCell::QdbtBorderlessComboCell (    ) 
 

The constructor creates a default combo box cell without border

QdbtBorderlessComboCell::QdbtBorderlessComboCell (  const QdbtBorderlessComboCell &    c ) 
 

This constructor creates a copy of the suppied combo box cell.

QdbtBorderlessComboCell::QdbtBorderlessComboCell (  int    value,
int    align = Qt::AlignLeft
) 
 

The constructor creates a combo box cell without border and sets the initially displayed item to value (meaning the item contentOfPopupMenu()[value] is displayed) and aligns the text of the combo box as specified in align.

QdbtBorderlessComboCell::~QdbtBorderlessComboCell (    )  [virtual]
 

Destructor


Member Function Documentation

bool QdbtBaseCell::aboutToBeEdited (  QdbtBaseTabular *    tab )  const [protected, inherited]
 

This function interacts with the table and clarifies, if a new editing session may be started. If this function returns FALSE, no edit session may be started currently.

See also:
beginEdit()

bool QdbtComboCell::acceptEdit (  QdbtBaseTabular *    tab,
int    row,
int    col
)  [protected, virtual, inherited]
 

After editing has been done (and e.g. Return/Enter has been pressed), this function evaluates if the modified cell content is acceptable (when a pattern for the cell's column has been set, this pattern is being matched) and notifies the user on the edit's outcome.

This function retreives the current value from the editor and stores it within the table's cell (if accepted)

Reimplemented from QdbtIntCell.

int QdbtIntCell::alignment (    )  const [inline, inherited]
 

Returns the alignment for placement of the number within the cell

See also:
setAlignment().

const QColor & QdbtBaseCell::background (  QdbtBaseTabular *    tab )  const [virtual, inherited]
 

This function computes the background color for a table's cell. This color is generated from the table-component's forground color, if it is existing. If not (e.g. if the pointer to the tabular tab is not supplied correctly), a default color or white is supplied.

Reimplemented in QdbtTableCell.

bool QdbtComboCell::beginEdit (  QdbtBaseTabular *    tab,
int    row,
int    col,
const QRect    cellGeometry
)  const [protected, virtual, inherited]
 

Begin a new edit session. For this purpose a line editor is being initialized and show at the place, that is being occupied by the table's cells at row, col with the geometry cellGeometry

Reimplemented from QdbtIntCell.

bool QdbtComboCell::cancelEdit (  QdbtBaseTabular *    tab,
int    row,
int    col
)  [protected, virtual, inherited]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtIntCell.

bool QdbtBaseCell::cleanupEditor (  QdbtBaseTabular *    tab )  const [protected, inherited]
 

This member cleans up a cell's editor and ensures that the editor is not visible any longer.

Parameters:
tab  The tabular, to which the cell belongs
Returns:
TRUE if the editor has been cleaned up correctly, FALSE otherwise. If this function returns FALSE, it has not take any actions.
Attention:
This function relies on the editor()-function to answer the correct cell editor widget.
See also:
prepareEditor()

QdbtBaseCell * QdbtBorderlessComboCell::clone (  QdbtBaseTabular *    )  const [protected, virtual]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtComboCell.

const QColor & QdbtBaseCell::color (  QdbtBaseTabular *    tab )  const [virtual, inherited]
 

This function computes the forground color for a table's cell. This color is generated from the table-component's forground color, if it is existing. If not (e.g. if the pointer to the tabular tab is not supplied correctly), a default color or black is supplied.

Reimplemented in QdbtTableCell.

QStringList QdbtComboCell::contentOfPopupMenu (    )  const [protected, virtual, inherited]
 

This method stores the content of a popup menu. Currently a subclass of QdbtComboCell has to be created to overwrite the content of the combo box.

QWidget * QdbtComboCell::editor (  QdbtBaseTabular *    tab )  const [protected, virtual, inherited]
 

This functions serves to determine the editor widget associated to a table cell. This function should be provided within a derived class, since the function determining if a tabular contains the keyboard focus relies on it. However it is safe to return 0, if no editor may be returned or even is only produced on demand.

Reimplemented from QdbtIntCell.

QFont QdbtBaseCell::font (  QdbtBaseTabular *    tab )  const [protected, inherited]
 

Read the font, that has been set for the QdbtTabular Widget. This font should be used for all text-editor facilities.

Parameters:
tab  The context (tabular), with which the cell is used

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

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

Same as getTextArea() for this cell type.

Reimplemented from QdbtIntCell.

QRect QdbtComboCell::getTextArea (    )  const [protected, virtual, inherited]
 

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

Same as getEditArea() for this cell type.

Reimplemented from QdbtIntCell.

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

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtComboCell.

bool QdbtBaseCell::isEditable (    )  const [inherited]
 

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

See also:
setEditable().

bool QdbtComboCell::keyEvent (  QdbtBaseTabular *    tab,
int    row,
int    col,
QKeyEvent *    e,
const QRect    cellGeometry
)  [protected, virtual, inherited]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtBaseCell.

bool QdbtComboCell::mouseEvent (  QdbtBaseTabular *    tab,
int    row,
int    col,
QMouseEvent *    e,
const QRect    cellGeometry
)  [protected, virtual, inherited]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtBaseCell.

void QdbtBaseCell::moveEditor (  QdbtBaseTabular *    tab,
const QRect    geom
)  const [protected, virtual, inherited]
 

This method is called whenever a table cell is being edited and the table is repainted. The method should check if the geometry of handed over is the same as the geometry applied to the editor widget and - if not - should resize or move the editor widget to the correct position.

The default implementation determines the editor widget by calling editor() and moves it to the correct location.

void QdbtBaseCell::notifyOnEditResult (  QdbtBaseTabular *    tab,
int    row,
int    col,
int    result,
QString    oldText
)  [protected, inherited]
 

This function interacts with the tabular components and may be used to communicate the result of an edit session to the remaining programm parts.

void QdbtBorderlessComboCell::paint (  QPainter *    p,
QdbtBaseTabular *    t,
const QRect &    r,
bool    selected,
bool    editing = FALSE
)  [protected, virtual]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtComboCell.

void QdbtBorderlessComboCell::paintFocus (  QPainter *    p,
QdbtBaseTabular *    t,
const QRect &    r,
bool    sel,
bool    ed = FALSE
)  [protected, virtual]
 

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QdbtComboCell.

void QdbtComboCell::paintFocusMethod (  QPainter *    p,
QdbtBaseTabular *    t,
const QRect &    r,
bool    selected,
bool    editing = FALSE,
int    modif = NO_MODIF
)  [protected, inherited]
 

This method actually paints the combo box focus rectangle cell according to its current configuration

void QdbtComboCell::paintMethod (  QPainter *    p,
QdbtBaseTabular *    t,
const QRect &    r,
bool    selected,
bool    editing = FALSE,
int    modif = NO_MODIF
)  [protected, inherited]
 

This method actually paints the combo box cell according to its current configuration

bool QdbtBaseCell::prepareEditor (  QdbtBaseTabular *    tab,
const QRect &    geom
)  const [protected, inherited]
 

Prepare the cell's editor for the about-to-be-started edit session.

Parameters:
tab  The tabular, to which this cell belongs
geom  The cell (and thus the editor's) geometry
Returns:
TRUE, if the editor has been configured appropriately, FALSE otherwise. If this function returns FALSE, it has not take any actions.
Attention:
This function relies on the editor()-function to anser the correct cell editor widget.
See also:
cleanupEditor()

void QdbtBaseCell::rightButtonClicked (  QdbtBaseTabular *    tab,
int    row,
int    col
)  const [inherited]
 

This functions informs the user, that the right mouse buttons has been pressed on top of the cell in row row and col col. This method should be used within each of the editor widgets mapped on top of the table components, for the 'normal' cells this signal is begin generated automatically.

void QdbtIntCell::setAlignment (  int    alignment )  [inline, inherited]
 

Set the alignment for placing the number within the cell Possible values are:

  • AlignLeft
  • AlignCenter
  • AlignRight
See also:
alignment().
Examples:
example4.cpp.

void QdbtBaseCell::setEditable (  bool    state )  [virtual, inherited]
 

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.cpp, example3.cpp, example4.cpp, and example5.cpp.

void QdbtBaseCell::setEditorEnabled (  QdbtBaseTabular *    tab,
bool    enable
)  const [protected, virtual, inherited]
 

This function serves to temporaryly disable/enable the editor widget, if there is any.

The default implementation determines the editor widget by calling editor() and disables or enables it according to enable.

void QdbtIntCell::setValue (  int    value )  [inline, inherited]
 

Set the value of the cell to value.

See also:
value(), text()

QString QdbtComboCell::text (    )  const [virtual, inherited]
 

Returns the text string of the cell ( taken from the contentOfPopupMenu() ).

See also:
value(), setValue()

Reimplemented from QdbtIntCell.

int QdbtIntCell::value (    )  const [inline, inherited]
 

Return the current value of the cell. During an edit session the value of the cell is not changed. The new value is transfered as soon as the session has been accepted.

See also:
setValue(), text()

int QdbtComboCell::widthHint (  const QFontMetrics &    fm )  const [virtual, inherited]
 

Returns the preferred width of the cell. This is the actual cell's text's width including border spacings.

See also:
heightHint().

Reimplemented from QdbtIntCell.


Member Data Documentation

QdbtBaseCell::bw = 4 [static, protected, inherited]
 

Default spacing value for tabular cells.


The documentation for this class was generated from the following files:
Generated on Mon Apr 22 12:21:56 2002 for QdbtTabular by doxygen1.2.15-20020421