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

Widget used to display table data. More...

#include <TBDataTab.qo.h>

Inheritance diagram for casa::TBDataTab:

Public Slots

void showWidgetInSplitter (QWidget *widget, bool isArray=false)
 Shows the given widget in the side panel. More...
 
void clearWidgetInSplitter ()
 Clears whatever widget (if any) is currently being displayed in the side panel. More...
 
void applyFormat (int index, TBFormat *format)
 Applies the given format to the field at the given index. More...
 
void clearFormat (int index)
 Clears the format on the field at the given index. More...
 
void clearAllFormats ()
 Clears all formats on all fields. More...
 

Signals

void dataChanged (int row, int col, casacore::String newVal)
 This signal is emitted when the user has edited a cell. More...
 
void rightWidgetClosed (QWidget *which)
 This signal is emitted when the side panel is closed. More...
 
void followReferenceRequested (casacore::String subtable, int index)
 This signal is emitted when the user right-clicks on an index and selects the "Follow subtable index reference" command. More...
 
void sortEntered ()
 This signal is emitted when a sort is applied to the table. More...
 
void sortCleared ()
 This signal is emitted when a sort is cleared from the table. More...
 
void columnHidden (int index, bool hidden)
 This signal is emitted when a column is shown or hidden. More...
 

Public Member Functions

 TBDataTab (TBTableTabs *tt)
 Constructor that takes the parent TBTableTabs. More...
 
 ~TBDataTab ()
 
QTableWidget * getTableWidget ()
 Returns the QTableWidget that displays the data. More...
 
QBrush & getSelectedCellBackground ()
 Returns the QBrush that is used to draw the background of any selected cells in the QTableWidget. More...
 
QBrush & getUnselectedCellBackground ()
 Retruns the QBrush that is used to draw the background of any unselected cells in the QTableWidget. More...
 
TBFilterRuleSequencegetFilter ()
 Returns the current row filter, or NULL if there is none. More...
 
void setFilter (TBFilterRuleSequence *rule)
 Sets the current filter to the given rules, but does NOT apply it. More...
 
TBFormatformatAt (int index)
 Returns the current format for the field at the given index, or NULL if there is none. More...
 
std::vector< std::pair
< casacore::String, bool > > * 
getSortFields ()
 Returns the current sort on the displayed data. More...
 
void updateTable (ProgressHelper *pp=NULL)
 Updates the QTableWidget with new data that has been loaded into the table backend. More...
 
void setData (int row, int col, TBData *newVal, bool format=true)
 Sets the given cell in the QTableWidget to the new value, but does NOT update the backend. More...
 
bool loadPage (int p)
 Loads the given page into the table backend, which then updates the display. More...
 
void refresh (int row, int col, bool format=true)
 Refreshes the table backend using TBTable::refresh(), then updates the displayed data using setData(). More...
 
void sortBy (std::vector< std::pair< casacore::String, bool > > &s)
 Sorts the displayed data with the given order. More...
 
void setSortIndicator (int index, bool asc)
 Sets the sort indicator on the QTableWidget for the given column with an ascending arrow if asc is true or a descending arrow otherwise. More...
 
void clearSortIndicator ()
 Clears the sort indicator on the QTableWidget. More...
 
void highlight (int row)
 Selects and highlights the given row in the table widget. More...
 
int visibleIndex (int logicalIndex)
 Returns the visible index for the row with the given logical index. More...
 
int logicalIndex (int visibleIndex)
 Returns the logical index for the row with the given visible index. More...
 
void hideColumn (int index, bool hidden)
 Hides (or shows) the column with the given index. More...
 
void formatField (int index)
 Opens a format dialog for the field with the given index. More...
 

Public Attributes

bool goForward
 Remembers whether you pressed the next or previous button. More...
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event)
 Catches the right-click event; if the right click is on a table cell and the displayed data could be an index, show the subtable index reference menu. More...
 

Private Slots

void pageBack ()
 Slot for page back button. More...
 
void pageForward ()
 Slot for page forward button. More...
 
void pageFirst ()
 Slot to go to first page. More...
 
void pageLast ()
 Slot to go to last page. More...
 
void pageGo ()
 Slot for page go button. More...
 
void notifyDataChanged (int row, int col)
 Slot for QTableWidget::cellChanged(). More...
 
void cellClicked (int row, int col)
 Slot for QTableWidget::currentCellChanged(). More...
 
void referenceMenuClicked (QAction *which)
 Slot for the menu command chosen from the reference menu shown on a right click. More...
 
void doubleClicked (int row, int col)
 Slot for QTableWidget::cellDoubleClicked(). More...
 
void displayFieldInfo ()
 Displays the tooltip for the last clicked header in a dialog. More...
 
void displayFieldStatistics ()
 Displays statistics (min, max, mean) for the last clicked header in a dialog. More...
 
void hideColumn ()
 Hides the column that was just right-clicked. More...
 
void formatField ()
 Formats the field that was just right-clicked. More...
 
void headerMoved ()
 Slot for when a column header is moved. More...
 
void restoreColumns ()
 Slot for the restore columns button. More...
 
void resizeHeaders ()
 Slot for the resize headers button. More...
 
void headerClicked (int index)
 Slot for QHeaderView::sectionClicked(). More...
 
void clearSort ()
 Slot for the clear sort button. More...
 
void copyData ()
 Slot for copying the currently selected text into the system clipboard. More...
 

Private Member Functions

void updatePageTrackers ()
 Update widgets that keep track of what page the browser is on. More...
 
void sort (int col, bool asc)
 Sorts on the given row. More...
 
void applyFilter ()
 Applies the current filter to the displayed rows. More...
 

Private Attributes

TBTableTabsttabs
 Useful pointers to table backend. More...
 
TBTabletable
 
int page
 The currently loaded page. More...
 
int loadRows
 How many rows per page are loaded at once. More...
 
QCloseableWidgetrightWidget
 Side panel. More...
 
std::vector< QTableWidgetItem * > highlightedCells
 casacore::List of cells that are highlighted (the row and column of the currently selected cell). More...
 
QBrush unselectedBackground
 Brushes used to draw the backgrounds of unselected and selected cells in the QTableWidget, respectively. More...
 
QBrush selectedBackground
 
TBFilterRuleSequencefilter
 Current row filter, or NULL if there is none. More...
 
std::vector< TBFormat * > formats
 Current field formats. More...
 
QFontColordefaultFormat
 "Cleared" format for cell text. More...
 
bool arrayOpened
 Indicates whether the side panel is currently open with an array or not. More...
 
TBArrayPanelarrayPanel
 Points to the current array panel, or NULL if there is none. More...
 
std::vector< QTableWidgetItem * > rowItems
 Keeps track of the un-sorted order of the rows. More...
 
std::vector< int > rowIndices
 Keeps track of the un-sorted order of the rows. More...
 
std::vector< std::pair
< casacore::String, bool > > 
currSort
 The current sort order. More...
 
int clickedHeader
 Used for handling right-clicks on headers. More...
 

Detailed Description

Widget used to display table data.

Synopsis

TBDataTab is the tab responsible for displaying table data in a QTableWidget. It also provides functionality for changing page and number of rows loaded, catching and passing on edit events, and handling double-click events.

Definition at line 107 of file TBDataTab.qo.h.

Constructor & Destructor Documentation

casa::TBDataTab::TBDataTab ( TBTableTabs tt)

Constructor that takes the parent TBTableTabs.

casa::TBDataTab::~TBDataTab ( )

Member Function Documentation

void casa::TBDataTab::applyFilter ( )
private

Applies the current filter to the displayed rows.

void casa::TBDataTab::applyFormat ( int  index,
TBFormat format 
)
slot

Applies the given format to the field at the given index.

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

Slot for QTableWidget::currentCellChanged().

Updates the display to highlight the row and column of the selected cell.

void casa::TBDataTab::clearAllFormats ( )
slot

Clears all formats on all fields.

void casa::TBDataTab::clearFormat ( int  index)
slot

Clears the format on the field at the given index.

void casa::TBDataTab::clearSort ( )
privateslot

Slot for the clear sort button.

Clears the sort on the table by moving the rows back to their original order.

void casa::TBDataTab::clearSortIndicator ( )

Clears the sort indicator on the QTableWidget.

void casa::TBDataTab::clearWidgetInSplitter ( )
slot

Clears whatever widget (if any) is currently being displayed in the side panel.

void casa::TBDataTab::columnHidden ( int  index,
bool  hidden 
)
signal

This signal is emitted when a column is shown or hidden.

void casa::TBDataTab::contextMenuEvent ( QContextMenuEvent *  event)
protected

Catches the right-click event; if the right click is on a table cell and the displayed data could be an index, show the subtable index reference menu.

Also show action for copying to the clipboard.

void casa::TBDataTab::copyData ( )
privateslot

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

void casa::TBDataTab::dataChanged ( int  row,
int  col,
casacore::String  newVal 
)
signal

This signal is emitted when the user has edited a cell.

The parameter describe which cell was edited and its new value.

void casa::TBDataTab::displayFieldInfo ( )
privateslot

Displays the tooltip for the last clicked header in a dialog.

void casa::TBDataTab::displayFieldStatistics ( )
privateslot

Displays statistics (min, max, mean) for the last clicked header in a dialog.

void casa::TBDataTab::doubleClicked ( int  row,
int  col 
)
privateslot

Slot for QTableWidget::cellDoubleClicked().

Catches a double-click event on a cell in the QTableWidget. If the value is a table type, opens the indicated table in a new tab. If the value is an array type, opens the array in the side panel. Otherwise, if the table is currently editable, enters into editing mode on that cell.

void casa::TBDataTab::followReferenceRequested ( casacore::String  subtable,
int  index 
)
signal

This signal is emitted when the user right-clicks on an index and selects the "Follow subtable index reference" command.

The String indicates which subtable was chosen, and the index indicates the chosen index which is the value of the cell that was right-clicked on.

TBFormat* casa::TBDataTab::formatAt ( int  index)

Returns the current format for the field at the given index, or NULL if there is none.

void casa::TBDataTab::formatField ( int  index)

Opens a format dialog for the field with the given index.

Applies the format that the user enters.

void casa::TBDataTab::formatField ( )
privateslot

Formats the field that was just right-clicked.

TBFilterRuleSequence* casa::TBDataTab::getFilter ( )

Returns the current row filter, or NULL if there is none.

QBrush& casa::TBDataTab::getSelectedCellBackground ( )

Returns the QBrush that is used to draw the background of any selected cells in the QTableWidget.

std::vector<std::pair<casacore::String, bool> >* casa::TBDataTab::getSortFields ( )

Returns the current sort on the displayed data.

Each pair in the vector is the name of the field with a bool indicating whether the sort is ascending or not.

QTableWidget* casa::TBDataTab::getTableWidget ( )

Returns the QTableWidget that displays the data.

QBrush& casa::TBDataTab::getUnselectedCellBackground ( )

Retruns the QBrush that is used to draw the background of any unselected cells in the QTableWidget.

void casa::TBDataTab::headerClicked ( int  index)
privateslot

Slot for QHeaderView::sectionClicked().

Catches a sorting click event on a column header and sorts accordingly.

void casa::TBDataTab::headerMoved ( )
privateslot

Slot for when a column header is moved.

Enables the "restore columns" button.

void casa::TBDataTab::hideColumn ( int  index,
bool  hidden 
)

Hides (or shows) the column with the given index.

Whether the column is shown or hidden depends on the "hidden" parameter.

void casa::TBDataTab::hideColumn ( )
privateslot

Hides the column that was just right-clicked.

void casa::TBDataTab::highlight ( int  row)

Selects and highlights the given row in the table widget.

bool casa::TBDataTab::loadPage ( int  p)

Loads the given page into the table backend, which then updates the display.

If the page is valid, the result of TBTableTabs::loadRows() is returned; otherwise false is returned.

int casa::TBDataTab::logicalIndex ( int  visibleIndex)

Returns the logical index for the row with the given visible index.

Rows may have differing visible and logical indices when a sort has been entered.

void casa::TBDataTab::notifyDataChanged ( int  row,
int  col 
)
privateslot

Slot for QTableWidget::cellChanged().

Catches changes from the QTableWidget and emits signals as needed.

void casa::TBDataTab::pageBack ( )
privateslot

Slot for page back button.

Goes back a page.

void casa::TBDataTab::pageFirst ( )
privateslot

Slot to go to first page.

void casa::TBDataTab::pageForward ( )
privateslot

Slot for page forward button.

Goes forward a page.

void casa::TBDataTab::pageGo ( )
privateslot

Slot for page go button.

Goes to the page specified in the page line edit.

void casa::TBDataTab::pageLast ( )
privateslot

Slot to go to last page.

void casa::TBDataTab::referenceMenuClicked ( QAction *  which)
privateslot

Slot for the menu command chosen from the reference menu shown on a right click.

Catches which subtable the user followed a reference and emits signals as needed.

void casa::TBDataTab::refresh ( int  row,
int  col,
bool  format = true 
)

Refreshes the table backend using TBTable::refresh(), then updates the displayed data using setData().

void casa::TBDataTab::resizeHeaders ( )
privateslot

Slot for the resize headers button.

Resizes the row and column headers to fit displayed contents. See QTableWidget::resizeRowsToContents() and QTableWidget::resizeColumnsToContents().

void casa::TBDataTab::restoreColumns ( )
privateslot

Slot for the restore columns button.

Moves all columns back to their original locations.

void casa::TBDataTab::rightWidgetClosed ( QWidget *  which)
signal

This signal is emitted when the side panel is closed.

The QWidget points to the widget that was just closed.

void casa::TBDataTab::setData ( int  row,
int  col,
TBData newVal,
bool  format = true 
)

Sets the given cell in the QTableWidget to the new value, but does NOT update the backend.

If format is true, then any existing format will be applied to the new value.

void casa::TBDataTab::setFilter ( TBFilterRuleSequence rule)

Sets the current filter to the given rules, but does NOT apply it.

void casa::TBDataTab::setSortIndicator ( int  index,
bool  asc 
)

Sets the sort indicator on the QTableWidget for the given column with an ascending arrow if asc is true or a descending arrow otherwise.

void casa::TBDataTab::showWidgetInSplitter ( QWidget *  widget,
bool  isArray = false 
)
slot

Shows the given widget in the side panel.

isArray should be true if the widget is a TBViewArray, false otherwise.

void casa::TBDataTab::sort ( int  col,
bool  asc 
)
private

Sorts on the given row.

If asc is true, sorts in ascending order, otherwise sorts in descending order.

void casa::TBDataTab::sortBy ( std::vector< std::pair< casacore::String, bool > > &  s)

Sorts the displayed data with the given order.

Each pair in the vector is the name of the field with a bool indicating whether the sort is ascending or not.

void casa::TBDataTab::sortCleared ( )
signal

This signal is emitted when a sort is cleared from the table.

void casa::TBDataTab::sortEntered ( )
signal

This signal is emitted when a sort is applied to the table.

void casa::TBDataTab::updatePageTrackers ( )
private

Update widgets that keep track of what page the browser is on.

void casa::TBDataTab::updateTable ( ProgressHelper pp = NULL)

Updates the QTableWidget with new data that has been loaded into the table backend.

If a ProgressHelper is provided, it will be updated periodically with progress information.

int casa::TBDataTab::visibleIndex ( int  logicalIndex)

Returns the visible index for the row with the given logical index.

Rows may have differing visible and logical indices when a sort has been entered.

Member Data Documentation

bool casa::TBDataTab::arrayOpened
private

Indicates whether the side panel is currently open with an array or not.

Definition at line 285 of file TBDataTab.qo.h.

TBArrayPanel* casa::TBDataTab::arrayPanel
private

Points to the current array panel, or NULL if there is none.

Definition at line 288 of file TBDataTab.qo.h.

int casa::TBDataTab::clickedHeader
private

Used for handling right-clicks on headers.

Keeps track of the last right-clicked header column number.

Definition at line 303 of file TBDataTab.qo.h.

std::vector<std::pair<casacore::String, bool> > casa::TBDataTab::currSort
private

The current sort order.

Definition at line 299 of file TBDataTab.qo.h.

QFontColor* casa::TBDataTab::defaultFormat
private

"Cleared" format for cell text.

Definition at line 282 of file TBDataTab.qo.h.

TBFilterRuleSequence* casa::TBDataTab::filter
private

Current row filter, or NULL if there is none.

Definition at line 276 of file TBDataTab.qo.h.

std::vector<TBFormat*> casa::TBDataTab::formats
private

Current field formats.

Definition at line 279 of file TBDataTab.qo.h.

bool casa::TBDataTab::goForward

Remembers whether you pressed the next or previous button.

Uses this when filter rules are applied to avoid displaying blank pages.

Definition at line 198 of file TBDataTab.qo.h.

std::vector<QTableWidgetItem*> casa::TBDataTab::highlightedCells
private

casacore::List of cells that are highlighted (the row and column of the currently selected cell).

Definition at line 266 of file TBDataTab.qo.h.

int casa::TBDataTab::loadRows
private

How many rows per page are loaded at once.

Definition at line 259 of file TBDataTab.qo.h.

int casa::TBDataTab::page
private

The currently loaded page.

Definition at line 256 of file TBDataTab.qo.h.

QCloseableWidget* casa::TBDataTab::rightWidget
private

Side panel.

Definition at line 262 of file TBDataTab.qo.h.

std::vector<int> casa::TBDataTab::rowIndices
private

Keeps track of the un-sorted order of the rows.

Doing rowIndices[visualRow] returns the logicalRow.

Definition at line 296 of file TBDataTab.qo.h.

std::vector<QTableWidgetItem*> casa::TBDataTab::rowItems
private

Keeps track of the un-sorted order of the rows.

Doing rowItems[logicalRow]->row() returns the visualRow.

Definition at line 292 of file TBDataTab.qo.h.

QBrush casa::TBDataTab::selectedBackground
private

Definition at line 272 of file TBDataTab.qo.h.

TBTable* casa::TBDataTab::table
private

Definition at line 252 of file TBDataTab.qo.h.

TBTableTabs* casa::TBDataTab::ttabs
private

Useful pointers to table backend.

Definition at line 251 of file TBDataTab.qo.h.

QBrush casa::TBDataTab::unselectedBackground
private

Brushes used to draw the backgrounds of unselected and selected cells in the QTableWidget, respectively.

Definition at line 271 of file TBDataTab.qo.h.


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