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.
 
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.
 
void syncRows ()
 Use this method to sync the table with the dock widget list if the table orientation is horizontal.
 
void saveAsTable ()
 This method will select a file, set it as the current file and save the table.
 
void saveTable ()
 This method allows the user to save the data from the table to the current file.
 
void clearTable ()
 This method clears all items from each row and column.
 
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.
 
void clearRow (int row)
 This method clears the text of the given row.
 
void setCurrentRow (int row)
 Sets the current row to row.
 
void setCurrentIndex (int currentIndex)
 Sets the current index to currentIndex.
 
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.
 
bool trackListItems ()
 Returns whether or not we should track items.
 
void loadTable ()
 This method loads a text file into the table.
 
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.
 
void resizeColumn (int columnIndex)
 

Signals

void fileLoaded ()
 Signal emitted when a file has loaded.
 

Public Member Functions

 TableMainWindow (QString title, QWidget *parent=0)
 Constructs a new TableMainWindow object.
 
void clear ()
 
QTableWidget * table () const
 Returns the table.
 
QList< QListWidgetItem * > itemList () const
 
QListWidget * listWidget () const
 Returns the list widget.
 
int selectedRows () const
 Returns the selected rows.
 
int currentIndex () const
 Returns the current index.
 
int currentRow () const
 Returns the current row.
 
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.
 
void deleteColumn (int item)
 This method deletes a column from the table.
 
void setStatusMessage (QString message)
 sets the status message in the lower lefthand corner of the window.
 
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.
 
void createTable ()
 This creates the table main window.
 
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.
 
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.
 
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.
 

Private Attributes

std::string p_appName
 The application name.
 
QWidgetp_parent
 The parent widget.
 
QString p_title
 The title string.
 
QDockWidgetp_dock
 The dock widget.
 
QActionp_save
 Action to save the table to the current file.
 
QFile p_currentFile
 The current file.
 
QTableWidget * p_table
 The table.
 
QPointer< QListWidget > p_listWidget
 List widget.
 
int p_selectedRows
 Number of selected rows.
 
int p_currentIndex
 Current index.
 
int p_currentRow
 Current row.
 
int p_visibleColumns
 Number of visible columns.
 
QList< int > p_startColumn
 List of start columns.
 
QList< int > p_endColumn
 List of end columns.
 
bool p_trackItems
 Boolean to track items.
 

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." <p> <p> 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. <p> <p> 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 <p> <p> 2017-10-06 Adam Goins - showTable() now calls syncColumns() after it calls this->show() so that it hides the unselected columns appropriately. Fixes #5141. <p> <p> 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. <p> <p> 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().

◆ ~TableMainWindow()

Isis::TableMainWindow::~TableMainWindow ( )

Definition at line 39 of file TableMainWindow.cpp.

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

◆ clear()

void Isis::TableMainWindow::clear ( )

Definition at line 44 of file TableMainWindow.cpp.

◆ 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.

◆ itemList()

QList< QListWidgetItem * > Isis::TableMainWindow::itemList ( ) const

Definition at line 53 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(), TableMainWindow(), and Isis::ViewportMainWindow::ViewportMainWindow().

◆ resizeColumn

void Isis::TableMainWindow::resizeColumn ( int columnIndex)
slot

Definition at line 62 of file TableMainWindow.cpp.

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

◆ settingsFileName() [1/2]

QString Isis::MainWindow::settingsFileName ( ) const
protectedinherited

Definition at line 96 of file MainWindow.cpp.

◆ settingsFileName() [2/2]

QString Isis::MainWindow::settingsFileName ( QString objectTitle)
staticinherited

Definition at line 43 of file MainWindow.cpp.

◆ 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(), Isis::PlotWindow::showTable(), and 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: