ICS

QicsTable Documentation Set

QicsTextCellDisplay Class Reference

A cell displayer for text and pixmaps. More...

#include <QicsTextCellDisplay.h>

Inherits QObject, and QicsMovableEntryWidgetCellDisplay.

List of all members.

Public Types

enum  QicsSortMode { QicsStableSort = 0, QicsQuickSort }
enum  QicsCellOverflowBehavior { Clip = 0, Overflow, ToolTip }
enum  QicsCurrentCellStyle { Spreadsheet = 0, NormalSelected }
enum  QicsGridCellClipping { AllowPartial = 0, NoDisplayOnPartial, UseClippedSymbol }
enum  QicsGridType { TableGrid = 0, RowHeaderGrid, ColumnHeaderGrid }
enum  QicsHeaderType { RowHeader = 0, ColumnHeader }
enum  QicsIndexType { RowIndex, ColumnIndex }
enum  QicsLineStyle { None = 0, Plain, Raised, Sunken }
enum  QicsRepaintBehavior { RepaintOff = 0, RepaintOn = 1, RepaintCalcOnly = 2 }
enum  QicsScrollBarMode { Auto = 0, AlwaysOff, AlwaysOn }
enum  QicsScrollDirection {
  ScrollNone = 0, ScrollUp, ScrollDown, ScrollLeft,
  ScrollRight, ScrollToRow, ScrollToColumn
}
enum  QicsSelectionPolicy {
  SelectNone = 0, SelectSingle, SelectMultiple, SelectSingleRow,
  SelectMultipleRow
}
enum  QicsSelectionType {
  SelectionNone = 0, SelectionBegin, SelectionDrag, SelectionEnd,
  SelectionExtend, SelectionAdd
}
enum  QicsSortOrder { Ascending = 0, Descending }
enum  QicsTableDisplayOption { DisplayNever = 0, DisplayAlways, DisplayFirstPage }
enum  QicsTraversalKeyEditBehavior { TraverseWithinCell = 0, TraverseBetweenCells }

Public Member Functions

 QicsTextCellDisplay ()
virtual void displayCell (QicsGrid *grid, int row, int col, const QicsDataItem *itm, QRect &rect, QPainter *painter)
virtual void startEdit (QicsScreenGrid *, int row, int col, const QicsDataItem *itm)
virtual void endEdit (QicsScreenGrid *, int row, int col)
virtual bool editWhenCurrent (void) const
virtual bool isEmpty (QicsGridInfo *info, int row, int col, const QicsDataItem *itm) const
virtual bool handleKeyEvent (QicsScreenGrid *grid, int row, int col, QKeyEvent *ke)
virtual QSize sizeHint (QicsGrid *grid, int row, int col, const QicsDataItem *itm)
virtual QString tooltipText (QicsGridInfo *info, int row, int col, const QicsDataItem *itm, const QRect &rect) const
virtual void moveEdit (QicsScreenGrid *, int row, int col, const QRect &rect)
virtual void hideEdit (QicsScreenGrid *)
virtual bool handleMouseEvent (QicsScreenGrid *grid, int row, int col, QMouseEvent *me)
virtual bool needsVisibilityNotification (void) const

Protected Types

typedef QList< QicsEntryWidgetInfo * > QicsEntryWidgetInfoPL

Protected Member Functions

QWidget * newEntryWidget (QicsScreenGrid *grid)
virtual QString textToDisplay (QicsGridInfo *info, int row, int col, const QicsDataItem *itm) const
virtual QPixmap pixmapToDisplay (QicsGridInfo *info, int row, int col, const QicsDataItem *itm) const
virtual bool canDisplayAll (QicsGridInfo *info, const QRect &rect, int row, int col, const QString &text, int text_flags, const QFont &font, const QPixmap &pix) const
virtual bool eventFilter (QObject *o, QEvent *e)
virtual bool setValue (QicsEntryWidgetInfo *info)
virtual void resetValue (QicsEntryWidgetInfo *info)
QicsEntryWidgetInfo * getInfoFromGrid (QicsScreenGrid *grid)
QicsEntryWidgetInfo * getInfoFromEntry (const QWidget *widget)
virtual QRect entryWidgetRect (QicsGridInfo *ginfo, int row, int col, QRect cell_rect)
virtual void drawBackground (QicsGridInfo *info, int row, int col, const QRect &rect, const QPalette &pal, QPainter *painter, bool is_current=false, bool is_selected=false)
virtual void drawBorder (QicsGridInfo *info, int row, int col, const QRect &rect, const QPalette &pal, QPainter *painter, bool is_current=false, bool is_selected=false)
virtual bool isCellSelected (QicsGridInfo *info, int row, int col)
virtual QPalette cellPalette (QicsGridInfo *info, int row, int col, bool for_printer=false)
virtual QRect displayableCellArea (QicsGridInfo *ginfo, int row, int col, const QRect &cr_full, bool consider_margin=true, bool consider_border=true) const

Protected Attributes

QEvent * myLastEvent
QicsEntryWidgetInfoPL myEntryList
QPointer< QicsCellmyCell
QPointer< QicsRowmyRow
QPointer< QicsColumnmyColumn
QPointer< QicsMainGridmyGrid


Detailed Description

A cell displayer for text and pixmaps.

The text cell display object draws text and/or a pixmap for each cell that is it assigned to. It uses a QLineEdit widget for data entry.

QicsTextCellDisplay displays text and pixmaps, taking into consideration a number of cell and grid properties. These properties are:

See Customizing Table Display Using Cell Display Objects for more information on creating or modifying a cell display class.


Member Enumeration Documentation

enum Qics::QicsCellOverflowBehavior [inherited]
 

Denotes the behavior of grids when handling cells whose contents cannot be displayed in the boundaries of the cell.

  • Clip Cell contents are clipped at the edges of the cell
  • Overflow The grid will attempt to overflow into adjacent cells
  • ToolTip The full contents of the cell will be displayed in a tooltip when the mouse pointer is hovered over the cell

enum Qics::QicsCurrentCellStyle [inherited]
 

Denotes the visual style that the current cell of the table will be drawn with.

  • Spreadsheet The current cell will be drawn with a solid border and will always use the cell's background color.
  • NormalSelected The current cell will be drawn the same as all other selected cells. The border will be as specified in the cell's border properties, and the background will be the cell's selected color.

enum Qics::QicsGridCellClipping [inherited]
 

Denotes the policy for displaying text that is too long to fit in its cell

  • AllowPartial Shows as much of the text as possible
  • NoDisplayOnPartial Do not display text if it cannot fit in the cell
  • UseClippedSymbol Display a clipped symbol at the end of the partial text

enum Qics::QicsGridType [inherited]
 

Specifies a type of grid object.

  • TableGrid A grid used to display normal table data
  • RowHeaderGrid A grid used to display row header data
  • ColumnHeaderGrid A grid used to display column header data

enum Qics::QicsHeaderType [inherited]
 

Specifies the type of table header.

  • HeaderRow A row header
  • HeaderColumn A column header

enum Qics::QicsIndexType [inherited]
 

Specifies the type of table index.

  • RowIndex A row index
  • ColumnIndex A column index

enum Qics::QicsLineStyle [inherited]
 

Denotes the style of lines and borders in the table widget.

  • None No line or border
  • Plain A simple, plain line or border
  • Raised A raised line (using shadows)
  • Sunken A sunken line (using shadows)

enum Qics::QicsRepaintBehavior [inherited]
 

Specifies the recalculation and repainting behavior of tables and grids.

  • RepaintOff Do not perform any drawing or dimension calculations
  • RepaintOn Draw as needed, keep all dimensions up to date
  • RepaintCalcOnly Do not draw, but keep all dimensions up to date

enum Qics::QicsScrollBarMode [inherited]
 

Specifies the various modes of QicsTable's scroll bars.

  • Auto QicsTable shows a scroll bar when the content is too large to fit and not otherwise.
  • AlwaysOff QicsTable never shows a scroll bar.
  • AlwaysOn QicsTable always shows a scroll bar.

enum Qics::QicsScrollDirection [inherited]
 

Denotes a direction for scrolling operations, or that an absolute scroll should occur.

  • ScrollNone no scroll allowed
  • ScrollUp scrolling up on a certain number of rows
  • ScrollDown scrolling down on a certain number of rows
  • ScrollLeft scrolling left on a certain number of columns
  • ScrollRight scrolling right on a certain number of columns
  • ScrollToRow scrolling up or down to a certain row
  • ScrollToColumn scrolling left or right to a certain column

enum Qics::QicsSelectionPolicy [inherited]
 

Denotes the selection policy for the table.

  • SelectNone no selection allowed
  • SelectSingle single cell selection
  • SelectionMultiple multiple cell selection (including non-contiguous regions)
  • SelectSingleRow selecting a cell selects the entire row, only one row can be selected
  • SelectMultipleRow selecting a cell selects the entire row, multiple rows can be selected

enum Qics::QicsSortMode [inherited]
 

Denotes the sort algorithm which is used

  • QicsStableSort Used non distructive, stable sort algorithm
  • QicsQuickSort Default quick sort algorithm.

enum Qics::QicsSortOrder [inherited]
 

Specifies whenever ordering should be ascending or descending.

  • Ascending Ascending order
  • Descending Descending order

enum Qics::QicsTableDisplayOption [inherited]
 

Specifies a printing display policy for elements of the table

  • DisplayNever Do not display the element when printing
  • DisplayAlways Always display the element when printing
  • DisplayFirstPage Display the element only when printing the first page of the table

enum Qics::QicsTraversalKeyEditBehavior [inherited]
 

Specifies the behavior of the traversal keys (left, right, up, down, etc) while editing a cell.

  • TraverseWithinCell Traversal keys move the text cursor within the edited cell.
  • TraverseBetweenCells Traversal keys move the current cell highlight between cells in the table.


Constructor & Destructor Documentation

QicsTextCellDisplay::QicsTextCellDisplay  ) 
 

Constructor for use by programmers.


Member Function Documentation

virtual bool QicsTextCellDisplay::canDisplayAll QicsGridInfo info,
const QRect &  rect,
int  row,
int  col,
const QString &  text,
int  text_flags,
const QFont &  font,
const QPixmap &  pix
const [protected, virtual]
 

Returns true if the pixmap (pix) and text (text, using text_flags and font) can be completely displayed in the area specified by rect.

Parameters:
info grid info object
rect area to display into
row row index in visual coordinates
col column index in visual coordinates
text text to display
text_flags flags for displaying text
font font to display text in
pix pixmap to display

virtual QPalette QicsCellDisplay::cellPalette QicsGridInfo info,
int  row,
int  col,
bool  for_printer = false
[protected, virtual, inherited]
 

Returns the palette to be used when drawing in cell (row, col ), using grid information from info. If for_printer is true, the palette will have a white background color substituted for any background colors that are the same as the default background color of the grid.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
for_printer will this palette be used to print?

Reimplemented in QicsComboCellDisplay.

virtual QRect QicsCellDisplay::displayableCellArea QicsGridInfo ginfo,
int  row,
int  col,
const QRect &  cr_full,
bool  consider_margin = true,
bool  consider_border = true
const [protected, virtual, inherited]
 

Returns a rectangle specifying the area of cell (row, col ) that can be used to display information. This rectangle is based on the full area of the cell (contained in cr_full ), minus the area reserved for the cell's border and margin.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
cr_full the full area of the cell
consider_margin should the returned area exclude the margin of the cell?
consider_border should the returned area exclude the border of the cell?

virtual void QicsTextCellDisplay::displayCell QicsGrid grid,
int  row,
int  col,
const QicsDataItem itm,
QRect &  rect,
QPainter *  painter
[virtual]
 

Displays the cell (row, col ) in grid widget grid. The cell will be displayed in region rect, using painter.

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates
itm the value to display. This value may be 0.
rect the rectangle to paint into
painter a painting context

Implements QicsCellDisplay.

virtual void QicsCellDisplay::drawBackground QicsGridInfo info,
int  row,
int  col,
const QRect &  rect,
const QPalette &  pal,
QPainter *  painter,
bool  is_current = false,
bool  is_selected = false
[protected, virtual, inherited]
 

Draws the background of cell (row, col ) using painter (based on cell and grid properties contained info) at the location specified by rect.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
rect location to draw in
pal color group to draw with
painter painter to draw with
is_current is this cell the current cell?
is_selected is this cell selected?

virtual void QicsCellDisplay::drawBorder QicsGridInfo info,
int  row,
int  col,
const QRect &  rect,
const QPalette &  pal,
QPainter *  painter,
bool  is_current = false,
bool  is_selected = false
[protected, virtual, inherited]
 

Draws the border of cell (row, col ) (based on cell and grid properties contained in info at the location specified by rect.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
rect location to draw in
pal color group to draw with
painter painter to draw with
is_current is this cell the current cell?
is_selected is this cell selected?

virtual bool QicsTextCellDisplay::editWhenCurrent void   )  const [inline, virtual]
 

Returns true if cells using this displayer should automatically be put into edit mode when they become the current cell in the table.

Reimplemented from QicsMovableEntryWidgetCellDisplay.

virtual void QicsTextCellDisplay::endEdit QicsScreenGrid ,
int  row,
int  col
[virtual]
 

This method is called by the grid widget when an edit operation of a cell should be ended. This would most commonly occur when the user traverses out of the cell via keyboard or mouse action.

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates

Reimplemented from QicsMovableEntryWidgetCellDisplay.

virtual QRect QicsMovableEntryWidgetCellDisplay::entryWidgetRect QicsGridInfo ginfo,
int  row,
int  col,
QRect  cell_rect
[protected, virtual, inherited]
 

Returns the rectangle which specifies the location and size for the entry widget to be placed.

Parameters:
ginfo grid info object
row the cell's row index
col the cell's column index
cell_rect the location and size of the cell to be edited

Reimplemented in QicsCheckCellDisplay.

virtual bool QicsTextCellDisplay::eventFilter QObject *  o,
QEvent *  e
[protected, virtual]
 

Event handler for the lineedit widget.

QicsEntryWidgetInfo* QicsMovableEntryWidgetCellDisplay::getInfoFromEntry const QWidget *  widget  )  [protected, inherited]
 

Returns the entry widget information for the specified entry widget.

QicsEntryWidgetInfo* QicsMovableEntryWidgetCellDisplay::getInfoFromGrid QicsScreenGrid grid  )  [protected, inherited]
 

Returns the entry widget information for the specified grid widget.

virtual bool QicsTextCellDisplay::handleKeyEvent QicsScreenGrid grid,
int  row,
int  col,
QKeyEvent *  ke
[virtual]
 

Handler for keyboard events that occur within cell (row, col ). This handler will forward key events to the text widget if the text widget is currently being used to edit cell (row, col ). Note that row and col are in visual coordinates.

Reimplemented from QicsCellDisplay.

virtual bool QicsCellDisplay::handleMouseEvent QicsScreenGrid grid,
int  row,
int  col,
QMouseEvent *  me
[virtual, inherited]
 

Handler for mouse events that occur within cell (row, col ). The handler must return true if the event was handled by the cell displayer (and thus should not be handled by the grid), or false otherwise.

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates
me the mouse event

Reimplemented in QicsCheckCellDisplay, and QicsComboCellDisplay.

virtual void QicsMovableEntryWidgetCellDisplay::hideEdit QicsScreenGrid  )  [virtual, inherited]
 

This method is called by the grid widget when the cell currently being edited is no longer visible on the screen. (This would most commonly occur when the user scrolls the table.)

Parameters:
grid the controlling grid

Implements QicsCellDisplay.

virtual bool QicsCellDisplay::isCellSelected QicsGridInfo info,
int  row,
int  col
[protected, virtual, inherited]
 

Returns true if cell (row, col ) is selected in grids described by info. If the grid(s) are main table grids, this method simply determines if the cell is contained in the current selection list. If the grid(s) are header grids, this method determines if all the cells in the header cell's row or column are selected.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates

virtual bool QicsTextCellDisplay::isEmpty QicsGridInfo info,
int  row,
int  col,
const QicsDataItem itm
const [virtual]
 

Returns true if the contents of cell (row, col ) (given data item itm ) are empty, false otherwise.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
itm item that will be displayed in the cell

Implements QicsCellDisplay.

virtual void QicsMovableEntryWidgetCellDisplay::moveEdit QicsScreenGrid ,
int  row,
int  col,
const QRect &  rect
[virtual, inherited]
 

This method is called by the grid widget when the cell currently being edited has changed location in the grid. This would most commonly occur when the table is scrolled while an edit operation is underway.

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates
rect the new location of the cell

Implements QicsCellDisplay.

Reimplemented in QicsCheckCellDisplay, and QicsComboCellDisplay.

virtual bool QicsCellDisplay::needsVisibilityNotification void   )  const [inline, virtual, inherited]
 

Returns true if this displayer should be notified when its cells are no longer visible in the grid, false otherwise.

Reimplemented in QicsWidgetCellDisplay.

QWidget* QicsTextCellDisplay::newEntryWidget QicsScreenGrid grid  )  [protected, virtual]
 

Creates a new entry widget as a child of grid. When deriving from this class, you should implement this method so that it returns a new instance of the type of entry widget you want to use.

Implements QicsMovableEntryWidgetCellDisplay.

virtual QPixmap QicsTextCellDisplay::pixmapToDisplay QicsGridInfo info,
int  row,
int  col,
const QicsDataItem itm
const [protected, virtual]
 

Returns the pixmap that should be displayed in cell (row, col ). Thsi method retrieves the cell's pixmap(), and returns the result.

Parameters:
info grid info object
row row index in visual coordinates
col column index in visual coordinates
itm data item to display

virtual void QicsTextCellDisplay::resetValue QicsEntryWidgetInfo *  info  )  [protected, virtual]
 

Resets the value in the lineedit widget to the value in the data model that is being displayed.

virtual bool QicsTextCellDisplay::setValue QicsEntryWidgetInfo *  info  )  [protected, virtual]
 

Attempts to retrieve text from the lineedit widget, validate it, convert the text to a QicsDataItem, and set the new value in the data model. Returns true if successful, false otherwise.

virtual QSize QicsTextCellDisplay::sizeHint QicsGrid grid,
int  row,
int  col,
const QicsDataItem itm
[virtual]
 

Returns the size that cell (row, col ) needs to be if it is to completely display itm.

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates
itm the value to display. This value may be 0.

Implements QicsCellDisplay.

virtual void QicsTextCellDisplay::startEdit QicsScreenGrid ,
int  row,
int  col,
const QicsDataItem itm
[virtual]
 

Begin an edit operation in cell (row, col ). This method is intended to be used as a "preparation" for an edit operation. It will be called by the grid in response to a user action or a programmatic call. Note that this method does not specify a location in the grid widget for the edit operation to take place. The location will be specified in a subsequent call to moveEdit().

Parameters:
grid the controlling grid
row the row in visual coordinates
col the column in visual coordinates
itm the value to edit. This value may be 0.

Implements QicsCellDisplay.

virtual QString QicsTextCellDisplay::textToDisplay QicsGridInfo info,
int  row,
int  col,
const QicsDataItem itm
const [protected, virtual]
 

Returns the text that should be displayed in cell (row, col ). This method retrieves the text representation of itm, attempts to format the text using the cell's formatter(), and returns the result.

Parameters:
info grid info object
row row index in visual coordinates
col column index in visual coordinates
itm data item to display

virtual QString QicsTextCellDisplay::tooltipText QicsGridInfo info,
int  row,
int  col,
const QicsDataItem itm,
const QRect &  rect
const [virtual]
 

Returns the text that a grid widget can display in a tooltip when the user hovers the mouse pointer over this cell.

Parameters:
info grid info object
row the row in visual coordinates
col the column in visual coordinates
itm item that will be displayed in the cell
rect size of the cell

Reimplemented from QicsCellDisplay.


The documentation for this class was generated from the following file:

All trademarks and copyrights on this page are properties of their respective owners.
The rest is copyright 1999-2006 Integrated Computer Solutions, Inc.