Isis 3.0
Back | Home
TableMainWindow.h
Go to the documentation of this file.
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);
50 
51  void clear();
52 
58  QTableWidget *table() const {
59  return p_table;
60  };
61 
62 
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;
145  QWidget *p_parent;
146  QString p_title;
147  QDockWidget *p_dock;
148 
149  QAction *p_save;
150  QFile p_currentFile;
151 
152  QTableWidget *p_table;
153  QPointer<QListWidget> p_listWidget;
154  int p_selectedRows;
155  int p_currentIndex;
156  int p_currentRow;
157 
158  int p_visibleColumns;
159  QList<int>p_startColumn;
160  QList<int>p_endColumn;
161  bool p_trackItems;
162 
163  };
164 };
165 
166 #endif
QTableWidget * table() const
Returns the table.
Definition: TableMainWindow.h:58
void setStatusMessage(QString message)
sets the status message in the lower lefthand corner of the window.
Definition: TableMainWindow.cpp:166
~TableMainWindow()
Definition: TableMainWindow.cpp:38
bool eventFilter(QObject *o, QEvent *e)
This event filter is installed in the constructor.
Definition: TableMainWindow.cpp:747
void saveAsTable()
This method will select a file, set it as the current file and save the table.
Definition: TableMainWindow.cpp:431
void clearRow(int row)
This method clears the text of the given row.
Definition: TableMainWindow.cpp:418
void deleteColumn(int item)
This method deletes a column from the table.
Definition: TableMainWindow.cpp:330
QListWidget * listWidget() const
Returns the list widget.
Definition: TableMainWindow.h:72
void hideEvent(QHideEvent *event)
Definition: TableMainWindow.cpp:779
int selectedRows() const
Returns the selected rows.
Definition: TableMainWindow.h:82
int currentRow() const
Returns the current row.
Definition: TableMainWindow.h:102
bool trackListItems()
Returns whether or not we should track items.
Definition: TableMainWindow.cpp:802
void createTable()
This creates the table main window.
Definition: TableMainWindow.cpp:67
void deleteRows()
This method is called when the user selects a row or rows uses the delete button or selects the delet...
Definition: TableMainWindow.cpp:380
void saveTable()
This method allows the user to save the data from the table to the current file.
Definition: TableMainWindow.cpp:462
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...
Definition: TableMainWindow.cpp:791
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...
Definition: TableMainWindow.cpp:537
QList< QListWidgetItem * > itemList() const
Definition: TableMainWindow.cpp:51
void closeEvent(QCloseEvent *event)
Definition: TableMainWindow.cpp:766
void writeSettings() const
This overriden method is called when the Tablemainwindow is closed or hidden to write the size and lo...
Definition: TableMainWindow.cpp:556
void clear()
Definition: TableMainWindow.cpp:42
void syncColumns()
This method hides and shows the columns according to which items the user has selected to be view-abl...
Definition: TableMainWindow.cpp:265
void setCurrentRow(int row)
Sets the current row to row.
Definition: TableMainWindow.cpp:812
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
Definition: TableMainWindow.h:45
TableMainWindow(QString title, QWidget *parent=0)
Constructs a new TableMainWindow object.
Definition: TableMainWindow.cpp:23
void clearTable()
This method clears all items from each row and column.
Definition: TableMainWindow.cpp:360
void loadTable()
This method loads a text file into the table.
Definition: TableMainWindow.cpp:572
int currentIndex() const
Returns the current index.
Definition: TableMainWindow.h:92
Base class for the Qisis main windows.
Definition: MainWindow.h:24
void fileLoaded()
Signal emitted when a file has loaded.
Definition: moc_TableMainWindow.cpp:195
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.
Definition: TableMainWindow.cpp:183
void showTable()
This method checks to see if the table has been created.
Definition: TableMainWindow.cpp:349
void setCurrentIndex(int currentIndex)
Sets the current index to currentIndex.
Definition: TableMainWindow.cpp:822
void syncRows()
Use this method to sync the table with the dock widget list if the table orientation is horizontal...
Definition: TableMainWindow.cpp:297

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:29:58