Isis 3.0 Programmer Reference
Back | Home
TableMainWindow.h
1 #ifndef TableMainWindow_h
2 #define TableMainWindow_h
3 
4 #include <QMainWindow>
5 #include <QMenu>
6 
7 #include <QListWidgetItem>
8 #include <QPointer>
9 
10 #include "MainWindow.h"
11 
12 class QTableWidget;
13 
14 namespace Isis {
45  class TableMainWindow : public MainWindow {
46  Q_OBJECT
47  public:
48  TableMainWindow(QString title, QWidget *parent = 0);
49  ~TableMainWindow();
50 
51  void clear();
52 
58  QTableWidget *table() const {
59  return p_table;
60  };
61 
62 
63  QList<QListWidgetItem *> itemList() const;
64 
65 
72  QListWidget *listWidget() const {
73  return p_listWidget;
74  };
75 
82  int selectedRows() const {
83  return p_selectedRows;
84  };
85 
92  int currentIndex() const {
93  return p_currentIndex;
94  };
95 
102  int currentRow() const {
103  return p_currentRow;
104  };
105 
106  void addToTable(bool setOn, const QString &heading,
107  const QString &menuText = "", int insertAt = -1,
108  Qt::Orientation o = Qt::Horizontal, QString toolTip = "");
109  void deleteColumn(int item);
110  void setStatusMessage(QString message);
111  void closeEvent(QCloseEvent *event);
112  void hideEvent(QHideEvent *event);
113 
114  public slots:
115  void showTable();
116  void syncColumns();
117  void syncRows();
118  void saveAsTable();
119  void saveTable();
120  void clearTable();
121  void deleteRows();
122  void clearRow(int row);
123  void setCurrentRow(int row);
124  void setCurrentIndex(int currentIndex);
125  void setTrackListItems(bool track = false);
126  bool trackListItems();
127  void loadTable();
128  void writeSettings() const;
129 
130  signals:
135  void fileLoaded();
136 
137  protected:
138  bool eventFilter(QObject *o, QEvent *e);
139  void createTable();
140  void readItemSettings(QString heading, QListWidgetItem *item,
141  bool defaultChecked);
142 
143  private:
144  std::string p_appName;
146  QString p_title;
147  QDockWidget *p_dock;
148 
151 
152  QTableWidget *p_table;
153  QPointer<QListWidget> p_listWidget;
157 
162 
163  };
164 };
165 
166 #endif
std::string p_appName
The application name.
QTableWidget * table() const
Returns the table.
QAction * p_save
Action to save the table to the current file.
void setStatusMessage(QString message)
sets the status message in the lower lefthand corner of the window.
bool eventFilter(QObject *o, QEvent *e)
This event filter is installed in the constructor.
int p_selectedRows
Number of selected rows.
void saveAsTable()
This method will select a file, set it as the current file and save the table.
int p_currentIndex
Current index.
QFile p_currentFile
The current file.
void clearRow(int row)
This method clears the text of the given row.
void deleteColumn(int item)
This method deletes a column from the table.
QListWidget * listWidget() const
Returns the list widget.
void hideEvent(QHideEvent *event)
int selectedRows() const
Returns the selected rows.
int currentRow() const
Returns the current row.
bool trackListItems()
Returns whether or not we should track items.
void createTable()
This creates the table main window.
void deleteRows()
This method is called when the user selects a row or rows uses the delete button or selects the delet...
bool p_trackItems
Boolean to track items.
void saveTable()
This method allows the user to save the data from the table to the current file.
void setTrackListItems(bool track=false)
If this property is true, the class will keep track of the checked/unchecked items in the dock area w...
void readItemSettings(QString heading, QListWidgetItem *item, bool defaultChecked)
This method reads the &#39;checked&#39; settings on the items listed in the dock area which determine which t...
QList< int > p_endColumn
List of end columns.
int p_currentRow
Current row.
QPointer< QListWidget > p_listWidget
List widget.
void closeEvent(QCloseEvent *event)
void writeSettings() const
This overriden method is called when the Tablemainwindow is closed or hidden to write the size and lo...
void syncColumns()
This method hides and shows the columns according to which items the user has selected to be view-abl...
int p_visibleColumns
Number of visible columns.
void setCurrentRow(int row)
Sets the current row to row.
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
TableMainWindow(QString title, QWidget *parent=0)
Constructs a new TableMainWindow object.
QString p_title
The title string.
void clearTable()
This method clears all items from each row and column.
void loadTable()
This method loads a text file into the table.
int currentIndex() const
Returns the current index.
Base class for the Qisis main windows.
Definition: MainWindow.h:24
void fileLoaded()
Signal emitted when a file has loaded.
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.
QList< int > p_startColumn
List of start columns.
void showTable()
This method checks to see if the table has been created.
QTableWidget * p_table
The table.
QWidget * p_parent
The parent widget.
QDockWidget * p_dock
The dock widget.
void setCurrentIndex(int currentIndex)
Sets the current index to currentIndex.
void syncRows()
Use this method to sync the table with the dock widget list if the table orientation is horizontal...

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:30:26