Isis 3 Programmer Reference
Isis::TableMainWindow Class Reference

a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks. More...

#include <TableMainWindow.h>

Inheritance diagram for Isis::TableMainWindow:
Inheritance graph
Collaboration diagram for Isis::TableMainWindow:
Collaboration graph

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...
 
QWidgetp_parent
 The parent widget. More...
 
QString p_title
 The title string. More...
 
QDockWidgetp_dock
 The dock widget. More...
 
QActionp_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...
 

Detailed Description

a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.

Author
????-??-?? Stacy Alley
History:

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.

Constructor & Destructor Documentation

◆ TableMainWindow()

Isis::TableMainWindow::TableMainWindow ( QString  title,
QWidget parent = 0 
)

Constructs a new TableMainWindow object.

Parameters
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().

Member Function Documentation

◆ addToTable()

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.

Parameters
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().

◆ clearRow

void Isis::TableMainWindow::clearRow ( int  row)
slot

This method clears the text of the given row.

Parameters
row

Definition at line 452 of file TableMainWindow.cpp.

References p_table.

Referenced by Isis::AdvancedTrackTool::mouseLeave(), Isis::MeasureTool::updateMeasure(), and Isis::AdvancedTrackTool::updateRow().

◆ clearTable

void Isis::TableMainWindow::clearTable ( )
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().

◆ closeEvent()

void Isis::TableMainWindow::closeEvent ( QCloseEvent *  event)
virtual
Parameters
event

Reimplemented from Isis::MainWindow.

Definition at line 850 of file TableMainWindow.cpp.

References Isis::MainWindow::closeEvent(), and writeSettings().

◆ createTable()

void Isis::TableMainWindow::createTable ( )
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().

◆ currentIndex()

int Isis::TableMainWindow::currentIndex ( ) const
inline

Returns the current index.

Returns
int

Definition at line 104 of file TableMainWindow.h.

References p_currentIndex.

Referenced by Isis::AdvancedTrackTool::record(), and setCurrentIndex().

◆ currentRow()

int Isis::TableMainWindow::currentRow ( ) const
inline

◆ deleteColumn()

void Isis::TableMainWindow::deleteColumn ( int  item)

This method deletes a column from the table.

Parameters
item

Definition at line 356 of file TableMainWindow.cpp.

References p_listWidget, p_table, and showTable().

◆ deleteRows

void Isis::TableMainWindow::deleteRows ( )
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().

◆ eventFilter()

bool Isis::TableMainWindow::eventFilter ( QObject o,
QEvent *  e 
)
protected

This event filter is installed in the constructor.

Parameters
o
e
Returns
bool

Definition at line 831 of file TableMainWindow.cpp.

References writeSettings().

◆ fileLoaded

void Isis::TableMainWindow::fileLoaded ( )
signal

Signal emitted when a file has loaded.

Referenced by loadTable().

◆ hideEvent()

void Isis::TableMainWindow::hideEvent ( QHideEvent *  event)
Parameters
event

Definition at line 863 of file TableMainWindow.cpp.

◆ listWidget()

QListWidget* Isis::TableMainWindow::listWidget ( ) const
inline

Returns the list widget.

Returns
QListWidget*

Definition at line 84 of file TableMainWindow.h.

References p_listWidget.

Referenced by Isis::PlotWindow::fillTable().

◆ loadTable

void Isis::TableMainWindow::loadTable ( )
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().

◆ readColumnSettings()

void Isis::TableMainWindow::readColumnSettings ( )
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().

◆ readItemSettings()

void Isis::TableMainWindow::readItemSettings ( QString  heading,
QListWidgetItem *  item,
bool  defaultChecked 
)
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.

Parameters
heading
item

Definition at line 571 of file TableMainWindow.cpp.

Referenced by addToTable().

◆ readSettings()

void Isis::MainWindow::readSettings ( QSize  defaultSize = QSize())
protectedvirtualinherited

This method ensure that the settings get written even if the Main window was only hidden, not closed.

Parameters
eventThis 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().

◆ saveAsTable

void Isis::TableMainWindow::saveAsTable ( )
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().

◆ saveTable

void Isis::TableMainWindow::saveTable ( )
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().

◆ selectedRows()

int Isis::TableMainWindow::selectedRows ( ) const
inline

Returns the selected rows.

Returns
int

Definition at line 94 of file TableMainWindow.h.

References p_selectedRows.

Referenced by deleteRows().

◆ setCurrentIndex

void Isis::TableMainWindow::setCurrentIndex ( int  currentIndex)
slot

Sets the current index to currentIndex.

Parameters
currentIndex

Definition at line 906 of file TableMainWindow.cpp.

References currentIndex(), and p_currentIndex.

Referenced by Isis::AdvancedTrackTool::record().

◆ setCurrentRow

void Isis::TableMainWindow::setCurrentRow ( int  row)
slot

Sets the current row to row.

Parameters
row

Definition at line 896 of file TableMainWindow.cpp.

References p_currentRow.

Referenced by Isis::AdvancedTrackTool::record(), and Isis::MeasureTool::rubberBandComplete().

◆ setStatusMessage()

void Isis::TableMainWindow::setStatusMessage ( QString  message)

sets the status message in the lower lefthand corner of the window.

Parameters
message

Definition at line 191 of file TableMainWindow.cpp.

Referenced by Isis::AdvancedTrackTool::AdvancedTrackTool(), Isis::MeasureTool::MeasureTool(), and Isis::SunShadowTool::SunShadowTool().

◆ setTrackListItems

void Isis::TableMainWindow::setTrackListItems ( bool  track = false)
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.

Parameters
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().

◆ showTable

void Isis::TableMainWindow::showTable ( )
slot

This method checks to see if the table has been created.

If not it calls the createTable method before calling show.

History:
2017-10-06 Adam Goins - showTable() now calls syncColumns() after it calls this->show() so that it hides the unselected columns appropriately. Fixes #5141.
History:
2017-10-06 Adam Goins - showTable() now calls syncColumns() after it calls this->show() so that it hides the unselected columns appropriately. Fixes #5141.

Definition at line 383 of file TableMainWindow.cpp.

References createTable(), p_table, and syncColumns().

Referenced by deleteColumn(), and Isis::AdvancedTrackTool::record().

◆ syncColumns

void Isis::TableMainWindow::syncColumns ( )
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().

◆ syncRows

void Isis::TableMainWindow::syncRows ( )
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.

◆ table()

◆ trackListItems

bool Isis::TableMainWindow::trackListItems ( )
slot

Returns whether or not we should track items.

Returns
bool

Definition at line 886 of file TableMainWindow.cpp.

References p_trackItems.

◆ writeSettings

void Isis::TableMainWindow::writeSettings ( ) const
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.

History:
2017-11-13 Adam Goins - Added the behavior of columns sizes to be written to the settings file so that they can be persistent through new instances of qview.

Definition at line 624 of file TableMainWindow.cpp.

References p_listWidget, and p_table.

Referenced by closeEvent(), and eventFilter().

Member Data Documentation

◆ p_appName

std::string Isis::TableMainWindow::p_appName
private

The application name.

Definition at line 159 of file TableMainWindow.h.

◆ p_currentFile

QFile Isis::TableMainWindow::p_currentFile
private

The current file.

Definition at line 165 of file TableMainWindow.h.

Referenced by loadTable(), saveAsTable(), and saveTable().

◆ p_currentIndex

int Isis::TableMainWindow::p_currentIndex
private

Current index.

Definition at line 170 of file TableMainWindow.h.

Referenced by clearTable(), currentIndex(), loadTable(), setCurrentIndex(), and TableMainWindow().

◆ p_currentRow

int Isis::TableMainWindow::p_currentRow
private

Current row.

Definition at line 171 of file TableMainWindow.h.

Referenced by clearTable(), currentRow(), deleteRows(), loadTable(), setCurrentRow(), and TableMainWindow().

◆ p_dock

QDockWidget* Isis::TableMainWindow::p_dock
private

The dock widget.

Definition at line 162 of file TableMainWindow.h.

Referenced by createTable().

◆ p_endColumn

QList<int> Isis::TableMainWindow::p_endColumn
private

List of end columns.

Definition at line 175 of file TableMainWindow.h.

Referenced by addToTable(), syncColumns(), and syncRows().

◆ p_listWidget

QPointer<QListWidget> Isis::TableMainWindow::p_listWidget
private

◆ p_parent

QWidget* Isis::TableMainWindow::p_parent
private

The parent widget.

Definition at line 160 of file TableMainWindow.h.

Referenced by TableMainWindow().

◆ p_save

QAction* Isis::TableMainWindow::p_save
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().

◆ p_selectedRows

int Isis::TableMainWindow::p_selectedRows
private

Number of selected rows.

Definition at line 169 of file TableMainWindow.h.

Referenced by selectedRows().

◆ p_startColumn

QList<int> Isis::TableMainWindow::p_startColumn
private

List of start columns.

Definition at line 174 of file TableMainWindow.h.

Referenced by addToTable(), syncColumns(), and syncRows().

◆ p_table

QTableWidget* Isis::TableMainWindow::p_table
private

◆ p_title

QString Isis::TableMainWindow::p_title
private

The title string.

Definition at line 161 of file TableMainWindow.h.

Referenced by loadTable(), saveTable(), and TableMainWindow().

◆ p_trackItems

bool Isis::TableMainWindow::p_trackItems
private

Boolean to track items.

Definition at line 176 of file TableMainWindow.h.

Referenced by setTrackListItems(), and trackListItems().

◆ p_visibleColumns

int Isis::TableMainWindow::p_visibleColumns
private

Number of visible columns.

Definition at line 173 of file TableMainWindow.h.

Referenced by syncColumns(), syncRows(), and TableMainWindow().


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