CustomTreeWidget Class Reference

A tree view widget with in-cell editing capbilities. More...

#include <CustomTreeWidget.h>

List of all members.

Public Types

enum  WidgetTypeEnum {
  NO_WIDGET = 0, LINE_EDIT, CUSTOM_LINE_EDIT, BROWSE_FILE_EDIT,
  BROWSE_DIR_EDIT, SHORTCUT_EDIT, COMBO_BOX, SPIN_BOX,
  DOUBLE_SPIN_BOX
}
enum  CheckStateEnum { UNCHECKED = 0, CHECKED, SEMI_CHECKED }
typedef EnumWrapper
< WidgetTypeEnum
WidgetType
typedef EnumWrapper
< CheckStateEnum
CheckState

Public Slots

void closeActiveCellWidget (bool bAcceptEdit)
void setBrowseDir (const QString &strDirectory)

Signals

void cellTextChanged (QTreeWidgetItem *pItem, int iColumn)
void cellIconChanged (QTreeWidgetItem *pItem, int iColumn)
void cellColorChanged (QTreeWidgetItem *pItem, int iColumn)
void cellCheckChanged (QTreeWidgetItem *pItem, int iColumn)
void deleteKeyPressed ()

Public Member Functions

 CustomTreeWidget (QWidget *parent=0)
virtual ~CustomTreeWidget ()
virtual void clear ()
bool setCellCheckState (QTreeWidgetItem *pItem, int iColumn, CheckState eState)
CheckState getCellCheckState (QTreeWidgetItem *pItem, int iColumn) const
bool setCellColor (QTreeWidgetItem *pItem, int iColumn, QColor clrCell)
QColor getCellColor (QTreeWidgetItem *pItem, int iColumn) const
void setFullCellColor (bool bFullCell)
bool getFullCellColor () const
void setColorWidth (int iWidth)
int getColorWidth () const
WidgetType getCellWidgetType (QTreeWidgetItem *pItem, int iColumn) const
bool setCellWidgetType (QTreeWidgetItem *pItem, int iColumn, WidgetType eType)
void setFullCellEdit (QTreeWidgetItem *pItem, int iColumn, bool bFullCell)
bool getFullCellEdit (QTreeWidgetItem *pItem, int iColumn) const
bool setCustomLineEdit (QTreeWidgetItem *pItem, int iColumn, QLineEdit *pLineEdit)
QLineEdit * getCustomLineEdit (QTreeWidgetItem *pItem, int iColumn) const
bool setFileBrowser (QTreeWidgetItem *pItem, int iColumn, FileBrowser *pFileBrowser)
FileBrowsergetFileBrowser (QTreeWidgetItem *pItem, int iColumn) const
bool setComboBox (QTreeWidgetItem *pItem, int iColumn, QComboBox *pCombo)
QComboBox * getComboBox (QTreeWidgetItem *pItem, int iColumn) const
bool setSpinBox (QTreeWidgetItem *pItem, int iColumn, QSpinBox *pSpin)
QSpinBox * getSpinBox (QTreeWidgetItem *pItem, int iColumn) const
bool setDoubleSpinBox (QTreeWidgetItem *pItem, int iColumn, QDoubleSpinBox *pSpin)
QDoubleSpinBox * getDoubleSpinBox (QTreeWidgetItem *pItem, int iColumn) const
void activateCellWidget (QTreeWidgetItem *pItem, int iColumn)
bool hitTest (QPoint ptCoord, QTreeWidgetItem *pItem, int iColumn)
void setGridlinesShown (Qt::Orientations orientations, bool bShow)
bool areGridlinesShown (Qt::Orientation orientation) const
bool eventFilter (QObject *pObject, QEvent *pEvent)

Protected Slots

void columnWidthChanged (int iColumn, int iOldWidth, int iNewWidth)
void setCurrentCellText (const QString &strText)
void browse ()
void acceptEditText ()
void closeEdit ()
void acceptCustomEditText ()
void closeCustomEdit ()
void acceptFileBrowserText ()
void closeFileBrowser ()
void acceptComboText ()
void closeCombo ()
void acceptSpinText ()
void closeSpin ()
void acceptDoubleSpinText ()
void closeDoubleSpin ()

Protected Member Functions

void mousePressEvent (QMouseEvent *e)
void mouseDoubleClickEvent (QMouseEvent *e)
void keyPressEvent (QKeyEvent *e)
int getColumnIndex (int iItemX) const
QRect getCellRect (QTreeWidgetItem *pItem, int iColumn) const
QRect getCellPixmapRect (QTreeWidgetItem *pItem, int iColumn) const
QRect getCellWidgetRect (QTreeWidgetItem *pItem, int iColumn) const
void drawRow (QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const

Classes

class  CellLocation
class  CustomTreeWidgetItemDelegate


Detailed Description

A tree view widget with in-cell editing capbilities.

The CustomTreeWidget extends the QTreeWidget class to provide in-cell editing to allow the user to change the value of a particular cell. The following edit capabilities are provided:

  Edit Capability     Description
  ==================  =======================================================
  None                The cell cannot be edited by the user.
  Check Box           The cell contains a check box that the user can toggle
                      on and off.  Text can optionally be displayed next to
                      the check box.
  Color               The cell contains a colored pixmap indicating the
                      selected color for the cell.  Text can optionally be
                      displayed next to the colored pixmap.
  Line Edit           A single-line edit is invoked for the user to enter
                      text when the user activates the cell.
  Custom Line Edit    A single-line edit is invoked for the user to enter
                      text when the user activates the cell.  Enhancements
                      or restrictions may be placed on the line edit such as
                      a custom alignment or echo mode, or a validator or
                      completer by creating a QLineEdit independently from
                      the tree widget and calling the setCustomLineEdit()
                      method.
  File Browser        A single-line edit box with a browse button is invoked
                      when the user activates the cell.  When the user clicks
                      the browse button, a file selection dialog is invoked
                      for the user to select a single file.
  Directory Browser   A single-line edit box with a browse button is invoked
                      when the user activates the cell.  When the user clicks
                      the browse button, a file selection dialog is invoked
                      for the user to select a directory.
  Shortcut Edit       A single-line edit box is invoked when the user
                      activates the cell.  As the user types, the keystrokes
                      are converted into key combinations that displayed in
                      the edit box.  Examples of key combinations include
                      "Ctrl+S", and "Shift+F5".
  Combo Box           A drop-down combo box is invoked when the user
                      activates the cell.  The combo box items are populated
                      by creating a QComboBox indepentently from the tree
                      widget and calling the setComboBox() method.
  Spin Box            A spin box is invoked when the user activates the cell.
                      The step size and range of values in the spin box are
                      set by creating a QSpinBox independently from the tree
                      widget and calling the setSpinBox() method.
  Double Spin Box     A double precision floating-point spin box is invoked when
                      the user activates the cell.  The step size and range of values
                      in the spin box are set by creating a QDoubleSpinBox independently
                      from the tree widget and calling the setDoubleSpinBox() method.
  

The default row height of tree widget items that are added to a custom tree widget is 20 pixels to provide additional room for an edit widget.

Each item can be drawn with horizontal gridlines, vertical gridlines, or both.

Definition at line 87 of file CustomTreeWidget.h.


Member Typedef Documentation

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are CustomTreeWidget::WidgetTypeEnum.

Definition at line 158 of file CustomTreeWidget.h.

The EnumWrapper contains a given enum value and provides a isValid() method which returns true if the contained enum value is valid.

Please see How To Use EnumWrapper for more information. The wrapped enum values are CustomTreeWidget::CheckStateEnum.

Definition at line 177 of file CustomTreeWidget.h.


Member Enumeration Documentation

Specifies the edit widget used in a cell of the tree widget.

See also:
setCellWidgetType()
Enumerator:
NO_WIDGET  A read-only cell that contains no edit widget.

LINE_EDIT  A single-line edit box is invoked when the user activates the cell. The line edit is automatically created and managed by the custom tree widget.

CUSTOM_LINE_EDIT  A single-line edit box is invoked when the user activates the cell. The line edit is created externally to the tree widget, and any enhancements or restrictions are added by the object creating the line edit. It is set into the tree widget with the setCustomLineEdit() method.

BROWSE_FILE_EDIT  A single-line edit box with a browse button is invoked when the user activates the cell. When the user clicks the browse button, a file selection dialog is invoked to select a single file.

BROWSE_DIR_EDIT  A single-line edit box with a browse button is invoked when the user activates the cell. When the user clicks the browse button, a file selection dialog is invoked to select a directory.

SHORTCUT_EDIT  A single-line edit box is invoked when the user activates the cell. As the user types in the edit box, the keystrokes are converted to keyboard shortcut combinations.

COMBO_BOX  A drop-down combo box is invoked when the user activates the cell. The combo box is created and populated by the object creating the tree widget. It is set into the tree widget with the setComboBox() method.

SPIN_BOX  A spin box for integer values is invoked when the user activates the cell. The spin box is created and its step size and range of values are determined by the object creating the tree widget. It is set into the tree widget with the setSpinBox() method.

DOUBLE_SPIN_BOX  A spin box for double precision floating-point values is invoked when the user activates the cell. The spin box is created and its step size and range of values are determined by the object creating the tree widget. It is set into the tree widget with the setDoubleSpinBox() method.

Definition at line 110 of file CustomTreeWidget.h.

Specifies the state of the edit check box in a cell of the tree widget.

See also:
setCellCheckState()
Enumerator:
UNCHECKED  The check box is not checked.

CHECKED  The check box is checked.

SEMI_CHECKED  The check box is partially checked, indicating that the check box represents multiple values, some of which are selected and some are not selected.

Definition at line 165 of file CustomTreeWidget.h.


Constructor & Destructor Documentation

CustomTreeWidget::CustomTreeWidget ( QWidget *  parent = 0  ) 

Creates a new, empty custom tree widget.

Parameters:
parent The parent widget.

virtual CustomTreeWidget::~CustomTreeWidget (  )  [virtual]

Destroys the custom tree widget and all child tree widget items.


Member Function Documentation

virtual void CustomTreeWidget::clear (  )  [virtual]

Deletes all tree widget items.

This method clears the tree widget by destroying all tree widget items, but the columns and their names and sizes are not changed.

bool CustomTreeWidget::setCellCheckState ( QTreeWidgetItem *  pItem,
int  iColumn,
CheckState  eState 
)

Displays a check box in a given cell and sets its check state.

Parameters:
pItem The item for which to display the check box and set its value.
iColumn The item column in which to display the check box and set its value.
eState The check state to set as the cell value.
Returns:
Returns true if the check box was successfully displayed and the value set; otherwise returns false.

CheckState CustomTreeWidget::getCellCheckState ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the current state of the check box in the given cell.

Parameters:
pItem The item for which to query a cell check state.
iColumn The item column to query its check state.
Returns:
The check state of the given cell. CustomTreeWidget::UNCHECKED is returned if the cell is not displaying a check box.

bool CustomTreeWidget::setCellColor ( QTreeWidgetItem *  pItem,
int  iColumn,
QColor  clrCell 
)

Displays a pixmap of a given color in a cell.

Parameters:
pItem The item for which to display the color pixmap and set its value.
iColumn The item column in which to display the color pixmap and set its value.
clrCell The color to set as the cell value. If an invalid color is given, the pixmap is removed from the cell.
Returns:
Returns true if the color pixmap is successfully displayed; otherwise returns false.

QColor CustomTreeWidget::getCellColor ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the current color of a given cell.

Parameters:
pItem The item for which to query a cell color.
iColumn The item column to query its color.
Returns:
The current cell color. An invalid color is returned if the cell is not currently displaying a color.

void CustomTreeWidget::setFullCellColor ( bool  bFullCell  ) 

Toggles whether the size of a color pixmap adjusts to the column width.

If a cell in an item is displaying a color pixmap, this method toggles the format for the pixmap width. The pixmap can either adjust to the column size, which automatically updates as the column is resized, or the pixmap can have a fixed width to allow text to be displayed next to the pixmap.

Calling this method affects all cells displaying a color pixmap and it has no effect if no cells currently display a color pixmap.

Parameters:
bFullCell Set this value to true to automatically adjust the pixmap size to the column width. Set this value to false to use a fixed size for the color pixmap.
See also:
setCellColor(), setColorWidth()

bool CustomTreeWidget::getFullCellColor (  )  const

Queries whether the size of a color pixmap adjusts to the column width.

Returns:
Returns true if the width of color pixmaps adjust to the column width. Returns false if the color pixmaps use a fixed width.

void CustomTreeWidget::setColorWidth ( int  iWidth  ) 

Sets a fixed width for cell color pixmaps.

This method sets a fixed width for all cells displaying a color pixmap. The default fixed width is 50 screen pixels. Calling this method has no effect if no cells currently display a color pixmap, or if the pixmap is set to adjust to the column width.

Parameters:
iWidth The width of the color pixmap.
See also:
setFullCellColor()

int CustomTreeWidget::getColorWidth (  )  const

Returns the fixed width for cell color pixmaps.

Returns:
The fixed width of the color pixmaps. A valid value is returned regardless of whether any cells are currently displaying color pixmaps or whether the pixmap width adjusts to the column width.

WidgetType CustomTreeWidget::getCellWidgetType ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the current edit widget type of a given cell.

Parameters:
pItem The item to get a cell edit widget type.
iColumn The item column to get its edit widget type.
Returns:
The cell edit widget type.

bool CustomTreeWidget::setCellWidgetType ( QTreeWidgetItem *  pItem,
int  iColumn,
WidgetType  eType 
)

Sets the current edit widget type of a given cell.

This method sets the current edit widget type for a cell. The edit widget can be used in conjunction with a cell color and a cell check box.

Parameters:
pItem The item to set a cell edit widget type. This item can either be present in the tree at the time this method is called or added at a later time.
iColumn The item column to set its edit widget type.
eType The edit widget type for the cell.

void CustomTreeWidget::setFullCellEdit ( QTreeWidgetItem *  pItem,
int  iColumn,
bool  bFullCell 
)

Toggles whether the cell edit widget covers the entire cell.

If a cell in an item contains an edit widget, this method toggles the format for the widget width. The widget can either cover the entire cell or just the portion of the cell not covered by the cell icon.

The default behavior is for the edit widget to cover the entire cell area.

Calling this method has no effect if the cell is read-only.

Parameters:
pItem The item to set a cell's edit widget width format.
iColumn The item column to set its edit widget width format.
bFullCell Set this value to true to automatically adjust the edit widget size to the column width. Set this value to false for the edit widget to not cover the cell icon.

bool CustomTreeWidget::getFullCellEdit ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Queries whether a cell edit widget covers the entire cell.

Parameters:
pItem The item to query for a cell's edit widget width format.
iColumn The item column to query its edit widget width format.
Returns:
Returns true if the edit widget of the given cell covers the entire cell. Returns false if the edit widget does not cover the cell icon..

bool CustomTreeWidget::setCustomLineEdit ( QTreeWidgetItem *  pItem,
int  iColumn,
QLineEdit *  pLineEdit 
)

Sets a custom line edit to use as the edit widget for a given cell.

This method sets a custom line edit as the edit widget for the given cell. The cell edit widget type must be set to CustomTreeWidget::CUSTOM_LINE_EDIT before this method is called.

Parameters:
pItem The item in which to set the custom line edit as a cell edit widget.
iColumn The item column in which to set the custom line edit as its edit widget.
pLineEdit The line edit to use as the edit widget. The line edit is reparented to the viewport widget, so it will automatically be deleted when the tree widget is deleted.
Returns:
Returns true if the line edit was successfully set as the edit widget; otherwise returns false.
See also:
setCellWidgetType()

QLineEdit* CustomTreeWidget::getCustomLineEdit ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the custom line edit used as the edit widget for a given cell.

Parameters:
pItem The item in which to get a cell custom line edit widget.
iColumn The item column in which to get the custom line edit widget.
Returns:
The custom line edit widget. A valid line edit pointer is returned regardless of the current edit widget if a line edit has been previously set as the edit widget but not reset to NULL.

bool CustomTreeWidget::setFileBrowser ( QTreeWidgetItem *  pItem,
int  iColumn,
FileBrowser pFileBrowser 
)

Sets the file browser to use as the edit widget for a given cell.

This method sets a file browser as the edit widget for the given cell. The cell edit widget type must be set to CustomTreeWidget::BROWSE_FILE_EDIT before this method is called.

Parameters:
pItem The item in which to set the file browser as a cell edit widget.
iColumn The item column in which to set the file browser as its edit widget.
pFileBrowser The file browser to use as the edit widget. The file browser is reparented to the viewport widget, so it will automatically be deleted when the tree widget is deleted.
Returns:
Returns true if the file browser was successfully set as the edit widget; otherwise returns false.
See also:
setCellWidgetType()

FileBrowser* CustomTreeWidget::getFileBrowser ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the file browser used as the edit widget for a given cell.

Parameters:
pItem The item in which to get a cell file browser edit widget.
iColumn The item column in which to get the file browser edit widget.
Returns:
The file browser edit widget. A valid item is returned regardless of the current edit widget if a file browser has been previously set as the edit widget but not reset to NULL.

bool CustomTreeWidget::setComboBox ( QTreeWidgetItem *  pItem,
int  iColumn,
QComboBox *  pCombo 
)

Sets the combo box to use as the edit widget for a given cell.

This method sets a combo box as the edit widget for the given cell. The cell edit widget type must be set to CustomTreeWidget::COMBO_BOX before this method is called.

Parameters:
pItem The item in which to set the combo box as a cell edit widget.
iColumn The item column in which to set the combo box as its edit widget.
pCombo The populated combo box to use as the edit widget. The combo box is reparented to the viewport widget, so it will automatically be deleted when the tree widget is deleted.
Returns:
Returns true if the combo box was successfully set as the edit widget; otherwise returns false.
See also:
setCellWidgetType()

QComboBox* CustomTreeWidget::getComboBox ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the combo box used as the edit widget for a given cell.

Parameters:
pItem The item in which to get a cell combo box edit widget.
iColumn The item column in which to get the combo box edit widget.
Returns:
The combo box edit widget. A valid item is returned regardless of the current edit widget if a combo box has been previously set as the edit widget but not reset to NULL.

bool CustomTreeWidget::setSpinBox ( QTreeWidgetItem *  pItem,
int  iColumn,
QSpinBox *  pSpin 
)

Sets the spin box to use as the edit widget for a given cell.

This method sets a spin box as the edit widget for the given cell. The cell edit widget type must be set to CustomTreeWidget::SPIN_BOX before this method is called.

Parameters:
pItem The item in which to set the spin box as a cell edit widget.
iColumn The item column in which to set the spin box as its edit widget.
pSpin The spin box to use as the edit widget. The spin box is reparented to the viewport widget, so it will automatically be deleted when the tree widget is deleted.
Returns:
Returns true if the spin box was successfully set as the edit widget; otherwise returns false.
See also:
setDoubleSpinBox(), setCellWidgetType()

QSpinBox* CustomTreeWidget::getSpinBox ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the spin box used as the edit widget for a given cell.

Parameters:
pItem The item in which to get a cell spin box edit widget.
iColumn The item column in which to get its spin box edit widget.
Returns:
The spin box edit widget. A valid item is returned regardless of the current edit widget if a spin box has been previously set as the edit widget but not reset to NULL.
See also:
getDoubleSpinBox()

bool CustomTreeWidget::setDoubleSpinBox ( QTreeWidgetItem *  pItem,
int  iColumn,
QDoubleSpinBox *  pSpin 
)

Sets the double spin box to use as the edit widget for a given cell.

This method sets a double spin box as the edit widget for the given cell. The cell edit widget type must be set to CustomTreeWidget::DOUBLE_SPIN_BOX before this method is called.

Parameters:
pItem The item in which to set the double spin box as a cell edit widget.
iColumn The item column in which to set the double spin box as its edit widget.
pSpin The double spin box to use as the edit widget. The double spin box is reparented to the viewport widget, so it will automatically be deleted when the tree widget is deleted.
Returns:
Returns true if the double spin box was successfully set as the edit widget; otherwise returns false.
See also:
setSpinBox(), setCellWidgetType()

QDoubleSpinBox* CustomTreeWidget::getDoubleSpinBox ( QTreeWidgetItem *  pItem,
int  iColumn 
) const

Returns the double spin box used as the edit widget for a given cell.

Parameters:
pItem The item in which to get a cell double spin box edit widget.
iColumn The item column in which to get its double spin box edit widget.
Returns:
The double spin box edit widget. A valid item is returned regardless of the current edit widget if a double spin box has been previously set as the edit widget but not reset to NULL.
See also:
getSpinBox()

void CustomTreeWidget::activateCellWidget ( QTreeWidgetItem *  pItem,
int  iColumn 
)

Invokes the edit widget for a given cell.

This method invokes the edit widget for a given cell. It does nothing if the cell edit widget type is CustomTreeWidget::NO_WIDGET.

Parameters:
pItem The item in which to invoke a cell edit widget.
iColumn The item column in which to invoke its edit widget.
See also:
CellType

bool CustomTreeWidget::hitTest ( QPoint  ptCoord,
QTreeWidgetItem *  pItem,
int  iColumn 
)

Tests if a given point is contained within a given item cell.

Parameters:
ptCoord The screen pixel coordinate to test.
pItem The item to test for the coordinate.
iColumn The item column to test for the coordinate.
Returns:
Returns true if the given coordinate is contained within the given item cell, otherwise returns false.

void CustomTreeWidget::setGridlinesShown ( Qt::Orientations  orientations,
bool  bShow 
)

Toggles the display of horizontal or vertical gridlines.

Parameters:
orientations Indicates whether to show or hide horizontal or vertical gridlines, or both.
bShow Set this value to true to display the gridlines, or to false to hide the gridlines.

bool CustomTreeWidget::areGridlinesShown ( Qt::Orientation  orientation  )  const

Queries whether gridlines are currently displayed.

Parameters:
orientation Indicates whether to show or hide either horizontal or vertical gridlines.
Returns:
Returns true if gridlines are displayed for the given orientation; otherwise returns false.

bool CustomTreeWidget::eventFilter ( QObject *  pObject,
QEvent *  pEvent 
)

Performs the keyboard shortcut conversion for the CustomTreeWidget::SHORTCUT_EDIT edit widget type.

Parameters:
pObject The object prompting the event.
pEvent The event invoked by the object.
Returns:
Returns true if a keyboard shortcut conversion was successfully performed; otherwise returns false.

void CustomTreeWidget::closeActiveCellWidget ( bool  bAcceptEdit  )  [slot]

Closes the active edit widget.

This method closes the active edit widget if it is currently invoked. It is often useful to call this method if the list view is contained inside a dialog and the user has clicked on the OK or Cancel buttons.

Parameters:
bAcceptEdit Set this value to true to accept any changes the user made in the edit widget before closing. Set this value to false to ignore any user changes.

void CustomTreeWidget::setBrowseDir ( const QString &  strDirectory  )  [slot]

Sets the initial browse directory.

This method pertains to the initial browse directory when the user clicks on the browse button for the CustomTreeWidget::BROWSE_DIR_EDIT edit widget type.

Parameters:
strDirectory The directory to set as the initial browse directory. Set this value to an empty string to use the current working directory.
See also:
setCellWidgetType()

void CustomTreeWidget::cellTextChanged ( QTreeWidgetItem *  pItem,
int  iColumn 
) [signal]

This signal is emitted when the text of a cell is changed.

Parameters:
pItem The item with modified text.
iColumn The item column containing the text that has changed.

void CustomTreeWidget::cellIconChanged ( QTreeWidgetItem *  pItem,
int  iColumn 
) [signal]

This signal is emitted when the pixmap of a cell is changed.

Parameters:
pItem The item with a modified pixmap.
iColumn The item column containing the pixmap that has changed.

void CustomTreeWidget::cellColorChanged ( QTreeWidgetItem *  pItem,
int  iColumn 
) [signal]

This signal is emitted when the color of a cell is changed.

Parameters:
pItem The item with a modified color.
iColumn The item column containing the color that has changed.

void CustomTreeWidget::cellCheckChanged ( QTreeWidgetItem *  pItem,
int  iColumn 
) [signal]

This signal is emitted when the check box state of a cell is changed.

Parameters:
pItem The item with a modified check box state.
iColumn The item column containing the check box whose state has changed.

void CustomTreeWidget::deleteKeyPressed (  )  [signal]

This signal is emitted when the delete key is pressed.

void CustomTreeWidget::mousePressEvent ( QMouseEvent *  e  )  [protected]

Invokes the cell edit widget.

This method is called by Qt when the user clicks inside the tree widget area. If an item cell is clicked and the item is selected, the edit widget is invoked. If the user clicked on a color pixmap, a common color selected dialog is invoked instead. If the user clicked on the check box, the check state is toggled.

Parameters:
e The mouse event associated with the mouse press.

void CustomTreeWidget::mouseDoubleClickEvent ( QMouseEvent *  e  )  [protected]

Invokes the cell edit widget.

This method is called by Qt when the user double clicks inside the tree widget area. If the item that is double clicked is not selected, it is selected and the edit widget is invoked by calling mousePressEvent().

Parameters:
e The mouse event associated with the mouse double click.

void CustomTreeWidget::keyPressEvent ( QKeyEvent *  e  )  [protected]

Performs common operation in response to key presses.

This method is called by Qt when the user presses a key on the keyboard. The default behavior is as follows:

  Key            Behavior
  =============  =========================================================
  Delete         Emits the deleteKeyPressed() signal.
  Esc            Closes the active edit widget and ignores any changes.
  Return/Enter   Closes the active edit widget and accepts any changes.
  Down Arrow     Closes the active edit widget and accepts any changes.
                 Selects the item below the currently selected item and
                 activates the edit widget in the same column as the edit
                 widget that was closed.
  Up Arrow       Closes the active edit widget and accepts any changes.
                 Selects the item above the currently selected item and
                 activates the edit widget in the same column as the edit
                 widget that was closed.
  Page Down      Closes the active edit widget and accepts any changes.
                 Scrolls the list view to display items below the
                 previously displayed items.
  Page Up        Closes the active edit widget and accepts any changes.
                 Scrolls the list view to display items above the
                 previously displayed items.
  

Parameters:
e The key event associated with the key press.
See also:
closeActiveCellWidget()

int CustomTreeWidget::getColumnIndex ( int  iItemX  )  const [protected]

Returns the index of the column at a given screen x-coordinate.

Parameters:
iItemX The screen x-coordinate value for which to get the column index.
Returns:
The index of the column at the given screen x-coordinate.

QRect CustomTreeWidget::getCellRect ( QTreeWidgetItem *  pItem,
int  iColumn 
) const [protected]

Returns the bounding rectangle of the given item cell.

The cell bounding rectangle is a combination of the pixmap rectangle and the edit widget rectangle.

Parameters:
pItem The item containing the cell for which to get its rectangle.
iColumn The item column identifying the cell for which to get its rectangle.
Returns:
The cell bounding rectangle.

QRect CustomTreeWidget::getCellPixmapRect ( QTreeWidgetItem *  pItem,
int  iColumn 
) const [protected]

Returns the rectangle of the pixmap in a given item cell.

Parameters:
pItem The item containing the cell for which to get the pixmap rectangle.
iColumn The item column identifying the cell for which to get its pixmap rectangle.
Returns:
The pixmap rectangle of the given cell.

QRect CustomTreeWidget::getCellWidgetRect ( QTreeWidgetItem *  pItem,
int  iColumn 
) const [protected]

Returns the rectangle of the edit widget in a given item cell.

Parameters:
pItem The item containing the cell for which to get the edit widget rectangle.
iColumn The item column identifying the cell for which to get its edit widget rectangle.
Returns:
The pixmap rectangle of the given cell.

void CustomTreeWidget::drawRow ( QPainter *  pPainter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const [protected]

Draws the gridlines for the row if necessary.

This method overrides the QTreeWidget base class implementation to draw the gridlines on each cell in the row if necessary.

Parameters:
pPainter The painter object in which to draw the cell in the row.
option The style in which the cell should be drawn.
index The index of the cell to draw.
See also:
setGridlinesShown()

void CustomTreeWidget::columnWidthChanged ( int  iColumn,
int  iOldWidth,
int  iNewWidth 
) [protected, slot]

Resizes the edit widget and/or the color pixmap.

This method is called when the user resizes a column. The color pixmap is resized if fixed widths are not used. Any active edit widget is also resized to fit within the bounding rectangle of the cell.

Parameters:
iColumn The item column whose width has changed.
iOldWidth The previous width of the item column.
iNewWidth The new width of the item column.

void CustomTreeWidget::setCurrentCellText ( const QString &  strText  )  [protected, slot]

Sets the text of the current cell.

This method is called when the user accepts changes in the active edit widget.

Parameters:
strText The new text for the cell.

void CustomTreeWidget::browse (  )  [protected, slot]

Invokes a directory selection dialog to select a directory.

This method is called when the user clicks on the browse button from the active edit widget to select a directory.

void CustomTreeWidget::acceptEditText (  )  [protected, slot]

Accepts the changes in the active line edit widget.

This method sets the cell text to the current text in the active line edit widget.

void CustomTreeWidget::closeEdit (  )  [protected, slot]

Hides the active line edit widget.

See also:
closeActiveCellWidget()

void CustomTreeWidget::acceptCustomEditText (  )  [protected, slot]

Accepts the changes in the active custom line edit widget.

This method sets the cell text to the current text in the active custom line edit widget.

void CustomTreeWidget::closeCustomEdit (  )  [protected, slot]

Hides the active custom line edit widget.

See also:
closeActiveCellWidget()

void CustomTreeWidget::acceptFileBrowserText (  )  [protected, slot]

Accepts the changes in the active file browser edit widget.

This method sets the cell text to the current text in the active file browser edit widget.

void CustomTreeWidget::closeFileBrowser (  )  [protected, slot]

Hides the active file browser edit widget.

See also:
closeActiveCellWidget()

void CustomTreeWidget::acceptComboText (  )  [protected, slot]

Accepts the changes in the active combo box edit widget.

This method sets the cell text to the current text in the active combo box edit widget.

void CustomTreeWidget::closeCombo (  )  [protected, slot]

Hides the active combo box edit widget.

See also:
closeActiveCellWidget()

void CustomTreeWidget::acceptSpinText (  )  [protected, slot]

Accepts the changes in the active spin box edit widget.

This method sets the cell text to the current value in the active spin box edit widget.

void CustomTreeWidget::closeSpin (  )  [protected, slot]

Hides the active spin box edit widget.

See also:
closeActiveCellWidget()

void CustomTreeWidget::acceptDoubleSpinText (  )  [protected, slot]

Accepts the changes in the active double spin box edit widget.

This method sets the cell text to the current value in the active double spin box edit widget.

void CustomTreeWidget::closeDoubleSpin (  )  [protected, slot]

Hides the active double spin box edit widget.

See also:
closeActiveCellWidget()


Software Development Kit - Opticks 4.9.0 Build 16218