Isis 3 Programmer Reference
|
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks. More...
#include <TableMainWindow.h>
Public Slots | |
void | showTable () |
This method checks to see if the table has been created. More... | |
void | syncColumns () |
This method hides and shows the columns according to which items the user has selected to be view-able on the left hand side list. More... | |
void | syncRows () |
Use this method to sync the table with the dock widget list if the table orientation is horizontal. More... | |
void | saveAsTable () |
This method will select a file, set it as the current file and save the table. More... | |
void | saveTable () |
This method allows the user to save the data from the table to the current file. More... | |
void | clearTable () |
This method clears all items from each row and column. More... | |
void | deleteRows () |
This method is called when the user selects a row or rows uses the delete button or selects the delete row menu item from the file menu. More... | |
void | clearRow (int row) |
This method clears the text of the given row. More... | |
void | setCurrentRow (int row) |
Sets the current row to row. More... | |
void | setCurrentIndex (int currentIndex) |
Sets the current index to currentIndex. More... | |
void | setTrackListItems (bool track=false) |
If this property is true, the class will keep track of the checked/unchecked items in the dock area which determines which columns are visible in the table. More... | |
bool | trackListItems () |
Returns whether or not we should track items. More... | |
void | loadTable () |
This method loads a text file into the table. More... | |
void | writeSettings () const |
This overriden method is called when the Tablemainwindow is closed or hidden to write the size and location settings (and dock widget settings) to a config file in the user's home directory. More... | |
void | resizeColumn (int columnIndex) |
Signals | |
void | fileLoaded () |
Signal emitted when a file has loaded. More... | |
Public Member Functions | |
TableMainWindow (QString title, QWidget *parent=0) | |
Constructs a new TableMainWindow object. More... | |
void | clear () |
QTableWidget * | table () const |
Returns the table. More... | |
QList< QListWidgetItem * > | itemList () const |
QListWidget * | listWidget () const |
Returns the list widget. More... | |
int | selectedRows () const |
Returns the selected rows. More... | |
int | currentIndex () const |
Returns the current index. More... | |
int | currentRow () const |
Returns the current row. More... | |
void | addToTable (bool setOn, const QString &heading, const QString &menuText="", int insertAt=-1, Qt::Orientation o=Qt::Horizontal, QString toolTip="") |
Adds a new column to the table when a new curve is added to the plot. More... | |
void | deleteColumn (int item) |
This method deletes a column from the table. More... | |
void | setStatusMessage (QString message) |
sets the status message in the lower lefthand corner of the window. More... | |
void | closeEvent (QCloseEvent *event) |
void | hideEvent (QHideEvent *event) |
Static Public Member Functions | |
static QString | settingsFileName (QString objectTitle) |
Protected Member Functions | |
bool | eventFilter (QObject *o, QEvent *e) |
This event filter is installed in the constructor. More... | |
void | createTable () |
This creates the table main window. More... | |
void | readItemSettings (QString heading, QListWidgetItem *item, bool defaultChecked) |
This method reads the 'checked' settings on the items listed in the dock area which determine which table columns are visible. More... | |
void | readColumnSettings () |
This method reads the columns in the table and sets their size to the appropriate size, or the size to auto based on what they were stored as. More... | |
QString | settingsFileName () const |
virtual void | readSettings (QSize defaultSize=QSize()) |
This method ensure that the settings get written even if the Main window was only hidden, not closed. More... | |
Private Attributes | |
std::string | p_appName |
The application name. More... | |
QWidget * | p_parent |
The parent widget. More... | |
QString | p_title |
The title string. More... | |
QDockWidget * | p_dock |
The dock widget. More... | |
QAction * | p_save |
Action to save the table to the current file. More... | |
QFile | p_currentFile |
The current file. More... | |
QTableWidget * | p_table |
The table. More... | |
QPointer< QListWidget > | p_listWidget |
List widget. More... | |
int | p_selectedRows |
Number of selected rows. More... | |
int | p_currentIndex |
Current index. More... | |
int | p_currentRow |
Current row. More... | |
int | p_visibleColumns |
Number of visible columns. More... | |
QList< int > | p_startColumn |
List of start columns. More... | |
QList< int > | p_endColumn |
List of end columns. More... | |
bool | p_trackItems |
Boolean to track items. More... | |
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
2008-06-12 Noah Hilt - Changed the save/load functions to work with blank entries.
2008-06-25 Noah Hilt - Fixed the delete rows method to search the entire row for values, rather than just the first column.
2008-10-17 Noah Hilt - Added an optional tooltip parameter to the addToTable method. This tooltip will be displayed over the checkbox that is to be added to the dock area.
2008-11-25 Noah Hilt - Added an action to save the table to a file that has been loaded or set with the save as action. This way the user does not have to reselect the file to save the table to.
2012-06-18 Steven Lambright - Gave the mac toolbar an object name for saving and restoring state. Fixes #851."
2013-02-21 Steven Lambright - Fixed a seg fault on destruction. This happened because the item list was being saved off independently; the items would be destroyed in the table widget but our copies of the pointers were not yet cleared. This has been fixed by adding the method itemList() instead of storing p_itemList. References #710.
2016-08-28 Kelvin Rodriguez - writeSettings now const to match parent and eliminate hidden virtual overload warnings in clang. Part of porting to OS X 10.11
2017-10-06 Adam Goins - showTable() now calls syncColumns() after it calls this->show() so that it hides the unselected columns appropriately. Fixes #5141.
2017-11-13 Adam Goins - Afforded TableMainWindow the ability to toggle between auto resizing columns or setting a specific column size for each column. modified createTable() to set the resize property of the columns to resize automatically based on the content inside of the column. Added resizeColumn() slot and readColumnSettings(). modified writeSettings() to write updated settings on destroy. Fixes #5142.
2018-04-20 Adam Goins - Added the ctrl+del keyboard shortcut to the TableMainWindow's "Clear Table" menu option. Fixes #4912.
Definition at line 57 of file TableMainWindow.h.
Isis::TableMainWindow::TableMainWindow | ( | QString | title, |
QWidget * | parent = 0 |
||
) |
Constructs a new TableMainWindow object.
title | |
parent |
Definition at line 24 of file TableMainWindow.cpp.
References createTable(), p_currentIndex, p_currentRow, p_parent, p_table, p_title, p_visibleColumns, readColumnSettings(), and Isis::MainWindow::readSettings().
void Isis::TableMainWindow::addToTable | ( | bool | setOn, |
const QString & | heading, | ||
const QString & | menuText = "" , |
||
int | insertAt = -1 , |
||
Qt::Orientation | o = Qt::Horizontal , |
||
QString | toolTip = "" |
||
) |
Adds a new column to the table when a new curve is added to the plot.
Also adds the item to the dock area.
setOn | |
heading | |
menuText | |
insertAt | |
o | |
toolTip |
Definition at line 208 of file TableMainWindow.cpp.
References p_endColumn, p_listWidget, p_startColumn, p_table, readColumnSettings(), and readItemSettings().
Referenced by Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::PlotWindow::fillTable(), Isis::MeasureTool::MeasureTool(), and Isis::SunShadowTool::SunShadowTool().
|
slot |
This method clears the text of the given row.
row |
Definition at line 452 of file TableMainWindow.cpp.
References p_table.
Referenced by Isis::AdvancedTrackTool::mouseLeave(), Isis::MeasureTool::updateMeasure(), and Isis::AdvancedTrackTool::updateRow().
|
slot |
This method clears all items from each row and column.
Definition at line 394 of file TableMainWindow.cpp.
References p_currentIndex, p_currentRow, and p_table.
Referenced by createTable(), and loadTable().
|
virtual |
event |
Reimplemented from Isis::MainWindow.
Definition at line 850 of file TableMainWindow.cpp.
References Isis::MainWindow::closeEvent(), and writeSettings().
|
protected |
This creates the table main window.
The table and docking area are created here. It also adds the two default menus to the menu bar. Programmers can add more menus to the menu bar once an instance of this class is established.
Definition at line 86 of file TableMainWindow.cpp.
References clearTable(), deleteRows(), loadTable(), p_dock, p_listWidget, p_save, p_table, saveAsTable(), saveTable(), and syncColumns().
Referenced by showTable(), and TableMainWindow().
|
inline |
Returns the current index.
Definition at line 104 of file TableMainWindow.h.
References p_currentIndex.
Referenced by Isis::AdvancedTrackTool::record(), and setCurrentIndex().
|
inline |
Returns the current row.
Definition at line 114 of file TableMainWindow.h.
References p_currentRow.
Referenced by Isis::AdvancedTrackTool::mouseLeave(), Isis::AdvancedTrackTool::record(), Isis::MeasureTool::rubberBandComplete(), Isis::AdvancedTrackTool::updateID(), Isis::MeasureTool::updateMeasure(), and Isis::AdvancedTrackTool::updateRow().
void Isis::TableMainWindow::deleteColumn | ( | int | item | ) |
This method deletes a column from the table.
item |
Definition at line 356 of file TableMainWindow.cpp.
References p_listWidget, p_table, and showTable().
|
slot |
This method is called when the user selects a row or rows uses the delete button or selects the delete row menu item from the file menu.
Definition at line 414 of file TableMainWindow.cpp.
References p_currentRow, p_table, and selectedRows().
Referenced by createTable().
|
protected |
This event filter is installed in the constructor.
o | |
e |
Definition at line 831 of file TableMainWindow.cpp.
References writeSettings().
|
signal |
Signal emitted when a file has loaded.
Referenced by loadTable().
void Isis::TableMainWindow::hideEvent | ( | QHideEvent * | event | ) |
event |
Definition at line 863 of file TableMainWindow.cpp.
|
inline |
Returns the list widget.
Definition at line 84 of file TableMainWindow.h.
References p_listWidget.
Referenced by Isis::PlotWindow::fillTable().
|
slot |
This method loads a text file into the table.
Definition at line 656 of file TableMainWindow.cpp.
References clearTable(), fileLoaded(), p_currentFile, p_currentIndex, p_currentRow, p_listWidget, p_save, p_table, and p_title.
Referenced by createTable().
|
protected |
This method reads the columns in the table and sets their size to the appropriate size, or the size to auto based on what they were stored as.
Definition at line 588 of file TableMainWindow.cpp.
References p_table.
Referenced by addToTable(), and TableMainWindow().
|
protected |
This method reads the 'checked' settings on the items listed in the dock area which determine which table columns are visible.
This method is only called if p_trackItems is set to true.
heading | |
item |
Definition at line 571 of file TableMainWindow.cpp.
Referenced by addToTable().
|
protectedvirtualinherited |
This method ensure that the settings get written even if the Main window was only hidden, not closed.
event | This method is called from the constructor so that when the Main window is created, it know's it's size and location. |
Reimplemented in Isis::MosaicMainWindow.
Definition at line 80 of file MainWindow.cpp.
Referenced by Isis::PlotWindow::PlotWindow(), Isis::MosaicMainWindow::readSettings(), TableMainWindow(), and Isis::ViewportMainWindow::ViewportMainWindow().
|
slot |
This method will select a file, set it as the current file and save the table.
Definition at line 465 of file TableMainWindow.cpp.
References p_currentFile, p_save, and saveTable().
Referenced by createTable().
|
slot |
This method allows the user to save the data from the table to the current file.
Definition at line 496 of file TableMainWindow.cpp.
References p_currentFile, p_save, p_table, and p_title.
Referenced by createTable(), and saveAsTable().
|
inline |
Returns the selected rows.
Definition at line 94 of file TableMainWindow.h.
References p_selectedRows.
Referenced by deleteRows().
|
slot |
Sets the current index to currentIndex.
currentIndex |
Definition at line 906 of file TableMainWindow.cpp.
References currentIndex(), and p_currentIndex.
Referenced by Isis::AdvancedTrackTool::record().
|
slot |
Sets the current row to row.
row |
Definition at line 896 of file TableMainWindow.cpp.
References p_currentRow.
Referenced by Isis::AdvancedTrackTool::record(), and Isis::MeasureTool::rubberBandComplete().
void Isis::TableMainWindow::setStatusMessage | ( | QString | message | ) |
sets the status message in the lower lefthand corner of the window.
message |
Definition at line 191 of file TableMainWindow.cpp.
Referenced by Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::MeasureTool::MeasureTool(), and Isis::SunShadowTool::SunShadowTool().
|
slot |
If this property is true, the class will keep track of the checked/unchecked items in the dock area which determines which columns are visible in the table.
track |
Definition at line 875 of file TableMainWindow.cpp.
References p_trackItems.
Referenced by Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::MeasureTool::MeasureTool(), Isis::PlotWindow::showTable(), and Isis::SunShadowTool::SunShadowTool().
|
slot |
This method checks to see if the table has been created.
If not it calls the createTable method before calling show.
Definition at line 383 of file TableMainWindow.cpp.
References createTable(), p_table, and syncColumns().
Referenced by deleteColumn(), and Isis::AdvancedTrackTool::record().
|
slot |
This method hides and shows the columns according to which items the user has selected to be view-able on the left hand side list.
(dock area)
Definition at line 291 of file TableMainWindow.cpp.
References p_endColumn, p_listWidget, p_startColumn, p_table, and p_visibleColumns.
Referenced by createTable(), showTable(), and Isis::PlotWindow::showTable().
|
slot |
Use this method to sync the table with the dock widget list if the table orientation is horizontal.
Definition at line 323 of file TableMainWindow.cpp.
References p_endColumn, p_listWidget, p_startColumn, p_table, and p_visibleColumns.
|
inline |
Returns the table.
Definition at line 70 of file TableMainWindow.h.
References p_table.
Referenced by Isis::SunShadowTool::addRow(), Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::PlotWindow::clearPlot(), Isis::PlotWindow::fillTable(), Isis::SunShadowTool::mouseMove(), Isis::AdvancedTrackTool::record(), Isis::MeasureTool::rubberBandComplete(), Isis::AdvancedTrackTool::updateID(), Isis::MeasureTool::updateMeasure(), Isis::SunShadowTool::updateRow(), Isis::MeasureTool::updateRow(), Isis::AdvancedTrackTool::updateRow(), and Isis::MeasureTool::updateRows().
|
slot |
Returns whether or not we should track items.
Definition at line 886 of file TableMainWindow.cpp.
References p_trackItems.
|
slot |
This overriden method is called when the Tablemainwindow is closed or hidden to write the size and location settings (and dock widget settings) to a config file in the user's home directory.
Definition at line 624 of file TableMainWindow.cpp.
References p_listWidget, and p_table.
Referenced by closeEvent(), and eventFilter().
|
private |
The application name.
Definition at line 159 of file TableMainWindow.h.
|
private |
The current file.
Definition at line 165 of file TableMainWindow.h.
Referenced by loadTable(), saveAsTable(), and saveTable().
|
private |
Current index.
Definition at line 170 of file TableMainWindow.h.
Referenced by clearTable(), currentIndex(), loadTable(), setCurrentIndex(), and TableMainWindow().
|
private |
Current row.
Definition at line 171 of file TableMainWindow.h.
Referenced by clearTable(), currentRow(), deleteRows(), loadTable(), setCurrentRow(), and TableMainWindow().
|
private |
|
private |
List of end columns.
Definition at line 175 of file TableMainWindow.h.
Referenced by addToTable(), syncColumns(), and syncRows().
|
private |
List widget.
Definition at line 168 of file TableMainWindow.h.
Referenced by addToTable(), createTable(), deleteColumn(), listWidget(), loadTable(), syncColumns(), syncRows(), and writeSettings().
|
private |
The parent widget.
Definition at line 160 of file TableMainWindow.h.
Referenced by TableMainWindow().
|
private |
Action to save the table to the current file.
Definition at line 164 of file TableMainWindow.h.
Referenced by createTable(), loadTable(), saveAsTable(), and saveTable().
|
private |
Number of selected rows.
Definition at line 169 of file TableMainWindow.h.
Referenced by selectedRows().
|
private |
List of start columns.
Definition at line 174 of file TableMainWindow.h.
Referenced by addToTable(), syncColumns(), and syncRows().
|
private |
The table.
Definition at line 167 of file TableMainWindow.h.
Referenced by addToTable(), clearRow(), clearTable(), createTable(), deleteColumn(), deleteRows(), loadTable(), readColumnSettings(), saveTable(), showTable(), syncColumns(), syncRows(), table(), TableMainWindow(), and writeSettings().
|
private |
The title string.
Definition at line 161 of file TableMainWindow.h.
Referenced by loadTable(), saveTable(), and TableMainWindow().
|
private |
Boolean to track items.
Definition at line 176 of file TableMainWindow.h.
Referenced by setTrackListItems(), and trackListItems().
|
private |
Number of visible columns.
Definition at line 173 of file TableMainWindow.h.
Referenced by syncColumns(), syncRows(), and TableMainWindow().