USGS

Isis 3.0 Object Programmers' Reference

Home

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

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 ()
 
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.
 
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.
 
QDockWidget * p_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."

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.

Definition at line 40 of file TableMainWindow.h.

Constructor & Destructor Documentation

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

Constructs a new TableMainWindow object.

Parameters
title
parent

Definition at line 15 of file TableMainWindow.cpp.

References createTable(), p_currentIndex, p_currentRow, p_parent, p_table, p_title, p_visibleColumns, and Isis::MainWindow::readSettings().

Member Function Documentation

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 175 of file TableMainWindow.cpp.

References p_endColumn, p_listWidget, p_startColumn, p_table, and readItemSettings().

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

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

This method clears the text of the given row.

Parameters
row

Definition at line 408 of file TableMainWindow.cpp.

References p_table.

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

void Isis::TableMainWindow::clearTable ( )
slot

This method clears all items from each row and column.

Definition at line 350 of file TableMainWindow.cpp.

References p_currentIndex, p_currentRow, and p_table.

Referenced by createTable(), and loadTable().

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

Reimplemented from Isis::MainWindow.

Definition at line 756 of file TableMainWindow.cpp.

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

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

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

Returns the current index.

Returns
int

Definition at line 87 of file TableMainWindow.h.

References p_currentIndex.

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

int Isis::TableMainWindow::currentRow ( ) const
inline
void Isis::TableMainWindow::deleteColumn ( int  item)

This method deletes a column from the table.

Parameters
item

Definition at line 320 of file TableMainWindow.cpp.

References p_listWidget, p_table, and showTable().

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 370 of file TableMainWindow.cpp.

References p_currentRow, p_table, and selectedRows().

Referenced by createTable().

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 737 of file TableMainWindow.cpp.

References writeSettings().

void Isis::TableMainWindow::fileLoaded ( )
signal

Signal emitted when a file has loaded.

Referenced by loadTable().

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

Definition at line 769 of file TableMainWindow.cpp.

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

Returns the list widget.

Returns
QListWidget*

Definition at line 67 of file TableMainWindow.h.

References p_listWidget.

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

void Isis::TableMainWindow::loadTable ( )
slot

This method loads a text file into the table.

Definition at line 562 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().

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 527 of file TableMainWindow.cpp.

Referenced by addToTable().

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.

Definition at line 79 of file MainWindow.cpp.

Referenced by Isis::PlotWindow::PlotWindow(), Isis::MosaicMainWindow::readSettings(), TableMainWindow(), and Isis::ViewportMainWindow::ViewportMainWindow().

void Isis::TableMainWindow::saveAsTable ( )
slot

This method will select a file, set it as the current file and save the table.

Definition at line 421 of file TableMainWindow.cpp.

References p_currentFile, p_save, and saveTable().

Referenced by createTable().

void Isis::TableMainWindow::saveTable ( )
slot

This method allows the user to save the data from the table to the current file.

Definition at line 452 of file TableMainWindow.cpp.

References p_currentFile, p_save, p_table, and p_title.

Referenced by createTable(), and saveAsTable().

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

Returns the selected rows.

Returns
int

Definition at line 77 of file TableMainWindow.h.

References p_selectedRows.

Referenced by deleteRows().

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

Sets the current index to currentIndex.

Parameters
currentIndex

Definition at line 812 of file TableMainWindow.cpp.

References currentIndex(), and p_currentIndex.

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

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

Sets the current row to row.

Parameters
row

Definition at line 802 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.

Parameters
message

Definition at line 158 of file TableMainWindow.cpp.

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

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 781 of file TableMainWindow.cpp.

References p_trackItems.

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

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.

Definition at line 339 of file TableMainWindow.cpp.

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

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

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 255 of file TableMainWindow.cpp.

References p_endColumn, p_listWidget, p_startColumn, p_table, and p_visibleColumns.

Referenced by createTable(), showTable(), and Isis::PlotWindow::showTable().

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 287 of file TableMainWindow.cpp.

References p_endColumn, p_listWidget, p_startColumn, p_table, and p_visibleColumns.

bool Isis::TableMainWindow::trackListItems ( )
slot

Returns whether or not we should track items.

Returns
bool

Definition at line 792 of file TableMainWindow.cpp.

References p_trackItems.

void Isis::TableMainWindow::writeSettings ( )
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 546 of file TableMainWindow.cpp.

References p_listWidget.

Referenced by closeEvent(), and eventFilter().

Member Data Documentation

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

The application name.

Definition at line 139 of file TableMainWindow.h.

QFile Isis::TableMainWindow::p_currentFile
private

The current file.

Definition at line 145 of file TableMainWindow.h.

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

int Isis::TableMainWindow::p_currentIndex
private

Current index.

Definition at line 150 of file TableMainWindow.h.

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

int Isis::TableMainWindow::p_currentRow
private

Current row.

Definition at line 151 of file TableMainWindow.h.

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

QDockWidget* Isis::TableMainWindow::p_dock
private

The dock widget.

Definition at line 142 of file TableMainWindow.h.

Referenced by createTable().

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

List of end columns.

Definition at line 155 of file TableMainWindow.h.

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

QPointer<QListWidget> Isis::TableMainWindow::p_listWidget
private
QWidget* Isis::TableMainWindow::p_parent
private

The parent widget.

Definition at line 140 of file TableMainWindow.h.

Referenced by TableMainWindow().

QAction* Isis::TableMainWindow::p_save
private

Action to save the table to the current file.

Definition at line 144 of file TableMainWindow.h.

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

int Isis::TableMainWindow::p_selectedRows
private

Number of selected rows.

Definition at line 149 of file TableMainWindow.h.

Referenced by selectedRows().

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

List of start columns.

Definition at line 154 of file TableMainWindow.h.

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

QTableWidget* Isis::TableMainWindow::p_table
private
QString Isis::TableMainWindow::p_title
private

The title string.

Definition at line 141 of file TableMainWindow.h.

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

bool Isis::TableMainWindow::p_trackItems
private

Boolean to track items.

Definition at line 156 of file TableMainWindow.h.

Referenced by setTrackListItems(), and trackListItems().

int Isis::TableMainWindow::p_visibleColumns
private

Number of visible columns.

Definition at line 153 of file TableMainWindow.h.

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


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