casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
casa::TBViewArray Class Reference

Widget for viewing array data in TBArray format. More...

#include <TBViewArray.qo.h>

Inheritance diagram for casa::TBViewArray:

Public Member Functions

 TBViewArray (TBTableTabs *tt, casacore::String first, casacore::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. More...
 
 ~TBViewArray ()
 
TBArrayDatagetArrayData ()
 Returns the array that is being displayed. More...
 
void setShouldRelease (bool b)
 Sets whether the arrays being viewed should release their data when closed or not. More...
 
TBDatadataAt (std::vector< int > d)
 Returns the data at the given coordinates, or NULL if the coordinates are invalid. More...
 
void setDataAt (std::vector< int > d, TBData &newVal, bool format=true)
 Sets the data at the given coordinates to the given value WITHOUT updating the table backend. More...
 
void applyFormat (TBFormat *f)
 Applies the given format to the array cells. More...
 
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). More...
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event)
 Catches the right-click event to allow for copying. More...
 

Private Slots

void dataChanged (int row, int col)
 Slot for when the user changes data in the array. More...
 
void sliceChanged (std::vector< int > newSlice)
 Slot for when the slicer changes (for arrays with dimensionality greater than two). More...
 
void cellClicked (int row, int col)
 Slot for when an array cell is clicked. More...
 
void cellDoubleClicked (int row, int col)
 Slot for when an array cell is double-clicked. More...
 
void copyData ()
 Slot for copying the currently selected text into the system clipboard. More...
 

Private Member Functions

void setup (casacore::String first, casacore::String second)
 Sets up the GUI components with the given parameters for the label. More...
 
std::vector< int > currentCell (int row, int col)
 Returns the array-relevant coordinates corresponding to the given indices. More...
 
void relabelHeaders ()
 Relabels the table headers to be 0- rather than 1-based. More...
 

Private Attributes

TBTableTabstTabs
 casacore::Table backend. More...
 
TBTablet
 
TBArrayDataarray
 casacore::Array being displayed. More...
 
bool update
 Flag to indicate whether GUI-generated events are "genuine.". More...
 
TBSlicerslicer
 casacore::Slicer for arrays with dimensionality greater than two. More...
 
std::vector< int > currentSlice
 Current slice for arrays with dimensionality greater than two. More...
 
bool editable
 Indicates whether this array is allowed to be edited. More...
 
QBrush unselectedBackground
 Background for unselected cells. More...
 
QBrush selectedBackground
 Background for selected cells. More...
 
std::vector< QTableWidgetItem * > selectedCells
 casacore::List of cells that are on the same row or column as the currently selected cell. More...
 
TBFormatformat
 Current format. More...
 
bool shouldRelease
 Indicates whether the underlying array data should be released when the view is closed or not. More...
 
int row
 Row of data array. More...
 
int col
 Column of data array. More...
 

Detailed Description

Widget for viewing array data in TBArray format.

Synopsis

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 64 of file TBViewArray.qo.h.

Constructor & Destructor Documentation

casa::TBViewArray::TBViewArray ( TBTableTabs tt,
casacore::String  first,
casacore::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.

casa::TBViewArray::~TBViewArray ( )

Member Function Documentation

void casa::TBViewArray::applyFormat ( TBFormat f)

Applies the given format to the array cells.

void casa::TBViewArray::cellClicked ( int  row,
int  col 
)
privateslot

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

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 ( )
privateslot

Slot for copying the currently selected text into the system clipboard.

std::vector<int> casa::TBViewArray::currentCell ( int  row,
int  col 
)
private

Returns the array-relevant coordinates corresponding to the given indices.

TBData* casa::TBViewArray::dataAt ( std::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 
)
privateslot

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.

TBArrayData* casa::TBViewArray::getArrayData ( )

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 ( std::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 ( casacore::String  first,
casacore::String  second 
)
private

Sets up the GUI components with the given parameters for the label.

void casa::TBViewArray::sliceChanged ( std::vector< int >  newSlice)
privateslot

Slot for when the slicer changes (for arrays with dimensionality greater than two).

Member Data Documentation

TBArrayData* casa::TBViewArray::array
private

casacore::Array being displayed.

Definition at line 116 of file TBViewArray.qo.h.

int casa::TBViewArray::col
private

Column of data array.

Definition at line 152 of file TBViewArray.qo.h.

std::vector<int> casa::TBViewArray::currentSlice
private

Current slice for arrays with dimensionality greater than two.

Definition at line 125 of file TBViewArray.qo.h.

bool casa::TBViewArray::editable
private

Indicates whether this array is allowed to be edited.

casacore::Data arrays should be true while keyword arrays should be false.

Definition at line 129 of file TBViewArray.qo.h.

TBFormat* casa::TBViewArray::format
private

Current format.

Definition at line 142 of file TBViewArray.qo.h.

int casa::TBViewArray::row
private

Row of data array.

Definition at line 149 of file TBViewArray.qo.h.

QBrush casa::TBViewArray::selectedBackground
private

Background for selected cells.

Definition at line 135 of file TBViewArray.qo.h.

std::vector<QTableWidgetItem*> casa::TBViewArray::selectedCells
private

casacore::List of cells that are on the same row or column as the currently selected cell.

Definition at line 139 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 146 of file TBViewArray.qo.h.

TBSlicer* casa::TBViewArray::slicer
private

casacore::Slicer for arrays with dimensionality greater than two.

Definition at line 122 of file TBViewArray.qo.h.

TBTable* casa::TBViewArray::t
private

Definition at line 112 of file TBViewArray.qo.h.

TBTableTabs* casa::TBViewArray::tTabs
private

casacore::Table backend.

Definition at line 111 of file TBViewArray.qo.h.

QBrush casa::TBViewArray::unselectedBackground
private

Background for unselected cells.

Definition at line 132 of file TBViewArray.qo.h.

bool casa::TBViewArray::update
private

Flag to indicate whether GUI-generated events are "genuine.".

Definition at line 119 of file TBViewArray.qo.h.


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