casa
5.7.0-16
|
Widget used to display table data. More...
#include <TBDataTab.qo.h>
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... | |
TBFilterRuleSequence * | getFilter () |
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... | |
TBFormat * | formatAt (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 | |
TBTableTabs * | ttabs |
Useful pointers to table backend. More... | |
TBTable * | table |
int | page |
The currently loaded page. More... | |
int | loadRows |
How many rows per page are loaded at once. More... | |
QCloseableWidget * | rightWidget |
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 |
TBFilterRuleSequence * | filter |
Current row filter, or NULL if there is none. More... | |
std::vector< TBFormat * > | formats |
Current field formats. More... | |
QFontColor * | defaultFormat |
"Cleared" format for cell text. More... | |
bool | arrayOpened |
Indicates whether the side panel is currently open with an array or not. More... | |
TBArrayPanel * | arrayPanel |
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... | |
Widget used to display table data.
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.
casa::TBDataTab::TBDataTab | ( | TBTableTabs * | tt | ) |
Constructor that takes the parent TBTableTabs.
casa::TBDataTab::~TBDataTab | ( | ) |
|
private |
Applies the current filter to the displayed rows.
|
slot |
Applies the given format to the field at the given index.
|
privateslot |
Slot for QTableWidget::currentCellChanged().
Updates the display to highlight the row and column of the selected cell.
|
slot |
Clears all formats on all fields.
|
slot |
Clears the format on the field at the given index.
|
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.
|
slot |
Clears whatever widget (if any) is currently being displayed in the side panel.
|
signal |
This signal is emitted when a column is shown or hidden.
|
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.
|
privateslot |
Slot for copying the currently selected text into the system clipboard.
|
signal |
This signal is emitted when the user has edited a cell.
The parameter describe which cell was edited and its new value.
|
privateslot |
Displays the tooltip for the last clicked header in a dialog.
|
privateslot |
Displays statistics (min, max, mean) for the last clicked header in a dialog.
|
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.
|
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.
|
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.
|
privateslot |
Slot for QHeaderView::sectionClicked().
Catches a sorting click event on a column header and sorts accordingly.
|
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.
|
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.
|
privateslot |
Slot for QTableWidget::cellChanged().
Catches changes from the QTableWidget and emits signals as needed.
|
privateslot |
Slot for page back button.
Goes back a page.
|
privateslot |
Slot to go to first page.
|
privateslot |
Slot for page forward button.
Goes forward a page.
|
privateslot |
Slot for page go button.
Goes to the page specified in the page line edit.
|
privateslot |
Slot to go to last page.
|
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().
|
privateslot |
Slot for the resize headers button.
Resizes the row and column headers to fit displayed contents. See QTableWidget::resizeRowsToContents() and QTableWidget::resizeColumnsToContents().
|
privateslot |
Slot for the restore columns button.
Moves all columns back to their original locations.
|
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.
|
slot |
Shows the given widget in the side panel.
isArray should be true if the widget is a TBViewArray, false otherwise.
|
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.
|
signal |
This signal is emitted when a sort is cleared from the table.
|
signal |
This signal is emitted when a sort is applied to the table.
|
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.
|
private |
Indicates whether the side panel is currently open with an array or not.
Definition at line 285 of file TBDataTab.qo.h.
|
private |
Points to the current array panel, or NULL if there is none.
Definition at line 288 of file TBDataTab.qo.h.
|
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.
|
private |
The current sort order.
Definition at line 299 of file TBDataTab.qo.h.
|
private |
"Cleared" format for cell text.
Definition at line 282 of file TBDataTab.qo.h.
|
private |
Current row filter, or NULL if there is none.
Definition at line 276 of file TBDataTab.qo.h.
|
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.
|
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.
|
private |
How many rows per page are loaded at once.
Definition at line 259 of file TBDataTab.qo.h.
|
private |
The currently loaded page.
Definition at line 256 of file TBDataTab.qo.h.
|
private |
Side panel.
Definition at line 262 of file TBDataTab.qo.h.
|
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.
|
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.
|
private |
Definition at line 272 of file TBDataTab.qo.h.
|
private |
Definition at line 252 of file TBDataTab.qo.h.
|
private |
Useful pointers to table backend.
Definition at line 251 of file TBDataTab.qo.h.
|
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.