casa
$Rev:20696$
|
Widget for viewing array data in TBArray format. More...
#include <TBViewArray.qo.h>
Public Member Functions | |
TBViewArray (TBTableTabs *tt, String first, String second, TBArrayData *arr, int row, int col, bool editable) | |
Constructor which takes the table parent, the "indices" where this array is located, the array to view, the location in the table (if applicable, and whether this array should be editable or not. | |
~TBViewArray () | |
TBArrayData * | getArrayData () |
Returns the array that is being displayed. | |
void | setShouldRelease (bool b) |
Sets whether the arrays being viewed should release their data when closed or not. | |
TBData * | dataAt (vector< int > d) |
Returns the data at the given coordinates, or NULL if the coordinates are invalid. | |
void | setDataAt (vector< int > d, TBData &newVal, bool format=true) |
Sets the data at the given coordinates to the given value WITHOUT updating the table backend. | |
void | applyFormat (TBFormat *f) |
Applies the given format to the array cells. | |
void | clearFormat (QFontColor *f) |
Clears the current format from the array cells and applies the given QFontColor (which should be the default table cell font and color). | |
Protected Member Functions | |
void | contextMenuEvent (QContextMenuEvent *event) |
Catches the right-click event to allow for copying. | |
Private Slots | |
void | dataChanged (int row, int col) |
Slot for when the user changes data in the array. | |
void | sliceChanged (vector< int > newSlice) |
Slot for when the slicer changes (for arrays with dimensionality greater than two). | |
void | cellClicked (int row, int col) |
Slot for when an array cell is clicked. | |
void | cellDoubleClicked (int row, int col) |
Slot for when an array cell is double-clicked. | |
void | copyData () |
Slot for copying the currently selected text into the system clipboard. | |
Private Member Functions | |
void | setup (String first, String second) |
Sets up the GUI components with the given parameters for the label. | |
vector< int > | currentCell (int row, int col) |
Returns the array-relevant coordinates corresponding to the given indices. | |
void | relabelHeaders () |
Relabels the table headers to be 0- rather than 1-based. | |
Private Attributes | |
TBTableTabs * | tTabs |
Table backend. | |
TBTable * | t |
TBArrayData * | array |
Array being displayed. | |
bool | update |
Flag to indicate whether GUI-generated events are "genuine.". | |
TBSlicer * | slicer |
Slicer for arrays with dimensionality greater than two. | |
vector< int > | currentSlice |
Current slice for arrays with dimensionality greater than two. | |
bool | editable |
Indicates whether this array is allowed to be edited. | |
QBrush | unselectedBackground |
Background for unselected cells. | |
QBrush | selectedBackground |
Background for selected cells. | |
vector< QTableWidgetItem * > | selectedCells |
List of cells that are on the same row or column as the currently selected cell. | |
TBFormat * | format |
Current format. | |
bool | shouldRelease |
Indicates whether the underlying array data should be released when the view is closed or not. | |
int | row |
Row of data array. | |
int | col |
Column of data array. |
Widget for viewing array data in TBArray format.
A TBViewArray displays potentially multi-dimensional array data in a QTableWidget. If the array has dimensionality greater than two, a TBSlicer is used to control the array slice.
Definition at line 67 of file TBViewArray.qo.h.
casa::TBViewArray::TBViewArray | ( | TBTableTabs * | tt, |
String | first, | ||
String | second, | ||
TBArrayData * | arr, | ||
int | row, | ||
int | col, | ||
bool | editable | ||
) |
Constructor which takes the table parent, the "indices" where this array is located, the array to view, the location in the table (if applicable, and whether this array should be editable or not.
The top of the array view will have a label that says "[table name][first, second] = [type] array of size [size]." For keyword arrays, row and col are irrelevant and editable should be false.
void casa::TBViewArray::applyFormat | ( | TBFormat * | f | ) |
Applies the given format to the array cells.
void casa::TBViewArray::cellClicked | ( | int | row, |
int | col | ||
) | [private, slot] |
Slot for when an array cell is clicked.
Updates cells in the same row or column with a "selected" background.
void casa::TBViewArray::cellDoubleClicked | ( | int | row, |
int | col | ||
) | [private, slot] |
Slot for when an array cell is double-clicked.
If the array is editable and the table is currently in editing mode, the user is then allowed to edit the cell data.
void casa::TBViewArray::clearFormat | ( | QFontColor * | f | ) |
Clears the current format from the array cells and applies the given QFontColor (which should be the default table cell font and color).
void casa::TBViewArray::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected] |
Catches the right-click event to allow for copying.
void casa::TBViewArray::copyData | ( | ) | [private, slot] |
Slot for copying the currently selected text into the system clipboard.
vector<int> casa::TBViewArray::currentCell | ( | int | row, |
int | col | ||
) | [private] |
Returns the array-relevant coordinates corresponding to the given indices.
TBData* casa::TBViewArray::dataAt | ( | vector< int > | d | ) |
Returns the data at the given coordinates, or NULL if the coordinates are invalid.
void casa::TBViewArray::dataChanged | ( | int | row, |
int | col | ||
) | [private, slot] |
Slot for when the user changes data in the array.
If the edit is valid, a TBEditArrayDataAction is generated and sent to the browser for execution.
Returns the array that is being displayed.
void casa::TBViewArray::relabelHeaders | ( | ) | [private] |
Relabels the table headers to be 0- rather than 1-based.
void casa::TBViewArray::setDataAt | ( | vector< int > | d, |
TBData & | newVal, | ||
bool | format = true |
||
) |
Sets the data at the given coordinates to the given value WITHOUT updating the table backend.
If format is true, then any current format is applied to the new value.
void casa::TBViewArray::setShouldRelease | ( | bool | b | ) |
Sets whether the arrays being viewed should release their data when closed or not.
void casa::TBViewArray::setup | ( | String | first, |
String | second | ||
) | [private] |
Sets up the GUI components with the given parameters for the label.
void casa::TBViewArray::sliceChanged | ( | vector< int > | newSlice | ) | [private, slot] |
Slot for when the slicer changes (for arrays with dimensionality greater than two).
TBArrayData* casa::TBViewArray::array [private] |
int casa::TBViewArray::col [private] |
Column of data array.
Definition at line 155 of file TBViewArray.qo.h.
vector<int> casa::TBViewArray::currentSlice [private] |
Current slice for arrays with dimensionality greater than two.
Definition at line 128 of file TBViewArray.qo.h.
bool casa::TBViewArray::editable [private] |
Indicates whether this array is allowed to be edited.
Data arrays should be true while keyword arrays should be false.
Definition at line 132 of file TBViewArray.qo.h.
TBFormat* casa::TBViewArray::format [private] |
Current format.
Definition at line 145 of file TBViewArray.qo.h.
int casa::TBViewArray::row [private] |
Row of data array.
Definition at line 152 of file TBViewArray.qo.h.
QBrush casa::TBViewArray::selectedBackground [private] |
Background for selected cells.
Definition at line 138 of file TBViewArray.qo.h.
vector<QTableWidgetItem*> casa::TBViewArray::selectedCells [private] |
List of cells that are on the same row or column as the currently selected cell.
Definition at line 142 of file TBViewArray.qo.h.
bool casa::TBViewArray::shouldRelease [private] |
Indicates whether the underlying array data should be released when the view is closed or not.
Definition at line 149 of file TBViewArray.qo.h.
TBSlicer* casa::TBViewArray::slicer [private] |
Slicer for arrays with dimensionality greater than two.
Definition at line 125 of file TBViewArray.qo.h.
TBTable* casa::TBViewArray::t [private] |
Definition at line 115 of file TBViewArray.qo.h.
TBTableTabs* casa::TBViewArray::tTabs [private] |
Table backend.
Definition at line 114 of file TBViewArray.qo.h.
QBrush casa::TBViewArray::unselectedBackground [private] |
Background for unselected cells.
Definition at line 135 of file TBViewArray.qo.h.
bool casa::TBViewArray::update [private] |
Flag to indicate whether GUI-generated events are "genuine.".
Definition at line 122 of file TBViewArray.qo.h.