scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

TableView.h
Go to the documentation of this file.
1 
11 
30 #ifndef TABLEVIEW_H
31 #define TABLEVIEW_H
32 
33 #include <QWidget>
34 #include <QTableView>
35 #include <QMessageBox>
36 #include <QHeaderView>
37 #include <QSize>
38 #include <QTabWidget>
39 #include <QPushButton>
40 #include <QToolButton>
41 #include <QHBoxLayout>
42 #include <QVBoxLayout>
43 #include <QLabel>
44 #include <QLineEdit>
45 #include <QTextEdit>
46 #include <QPushButton>
47 #include <QComboBox>
48 #include <QSpinBox>
49 #include <QScrollArea>
50 #include "ui_controltabs.h"
51 #include <QtDebug>
52 #include <QPointer>
53 #include "globals.h"
54 #include "MyWidget.h"
55 #include "lib/IntervalAttribute.h"
56 
57 class Column;
58 namespace future{ class Table; }
59 class TableModel;
60 class TableItemDelegate;
62 class AbstractAspect;
63 
65 class TableViewWidget : public QTableView
66 {
67  Q_OBJECT
68 
69  public:
71  TableViewWidget(QWidget * parent = 0) : QTableView(parent) {};
72 
73  protected:
75  virtual void keyPressEvent(QKeyEvent * event);
76 
77  signals:
78  void advanceCell();
79 
80  protected slots:
82  void updateHeaderGeometry(Qt::Orientation o, int first, int last);
83  public slots:
84  void selectAll();
85 };
86 
88 class TableView : public MyWidget
89 {
90  Q_OBJECT
91 
92  public:
94 #ifndef LEGACY_CODE_0_2_x
95  TableView(future::Table * table);
96 #else
97  TableView(const QString & label, QWidget * parent=0, const QString name=0, Qt::WindowFlags f=0);
98  void setTable(future::Table * table);
99 #endif
100  virtual ~TableView();
102  bool isControlTabBarVisible() { return d_control_tabs->isVisible(); }
104  void showComments(bool on = true);
106  bool areCommentsShown() const;
107 
109 
110 
115  int selectedColumnCount(bool full = false);
119 
123  bool isColumnSelected(int col, bool full = false);
125 
129  QList<Column *> selectedColumns(bool full = false);
131 
135  int selectedRowCount(bool full = false);
137 
141  bool isRowSelected(int row, bool full = false);
143 
147  int firstSelectedColumn(bool full = false);
149 
153  int lastSelectedColumn(bool full = false);
155 
159  int firstSelectedRow(bool full = false);
161 
165  int lastSelectedRow(bool full = false);
167  IntervalAttribute<bool> selectedRows(bool full = false);
169  bool hasMultiSelection();
171  bool isCellSelected(int row, int col);
173  void setCellSelected(int row, int col, bool select = true);
175  void setCellsSelected(int first_row, int first_col, int last_row, int last_col, bool select = true);
177  void getCurrentCell(int * row, int * col);
179 
180  void setColumnWidth(int col, int width);
181  int columnWidth(int col) const;
182  bool formulaModeActive() const;
183 
184  public slots:
185  void activateFormulaMode(bool on);
186  void goToCell(int row, int col);
187  void rereadSectionSizes();
188  void selectAll();
189  void deselectAll();
190  void toggleControlTabBar();
191  void toggleComments();
193  void showControlTypeTab();
194  void showControlFormulaTab();
195  void handleHorizontalSectionResized(int logicalIndex, int oldSize, int newSize);
196  void goToNextColumn();
197  void goToPreviousColumn();
198 
199  protected slots:
201  void advanceCell();
202  void handleHorizontalSectionMoved(int index, int from, int to);
203  void handleHorizontalHeaderDoubleClicked(int index);
207  void handleAspectAboutToBeRemoved(const AbstractAspect *aspect, int index);
208  void updateTypeInfo();
209  void updateFormatBox();
210  void handleHeaderDataChanged(Qt::Orientation orientation, int first, int last);
211  void currentColumnChanged(const QModelIndex & current, const QModelIndex & previous);
212  void selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
213  void applyDescription();
214  void applyType();
215 
216  protected:
221 
222  virtual void changeEvent(QEvent * event);
223  void retranslateStrings();
224  void setColumnForControlTabs(int col);
225 
226  bool eventFilter( QObject * watched, QEvent * event);
227 
229  Ui::ControlTabs ui;
233  QWidget * d_control_tabs;
235  QToolButton * d_hide_button;
236  QHBoxLayout * d_main_layout;
238  QPointer<future::Table> d_table;
239 
241  void init();
242 };
243 
244 
245 #endif
TableModel
Model for the access to a Table.
Definition: TableModel.h:54
future
Definition: AbstractAspect.h:43
TableView::toggleComments
void toggleComments()
Definition: TableView.cpp:350
TableViewWidget
Helper class for TableView.
Definition: TableView.h:66
TableView::d_hide_button
QToolButton * d_hide_button
Button to toogle the visibility of #d_tool_box.
Definition: TableView.h:235
TableView::d_main_layout
QHBoxLayout * d_main_layout
Definition: TableView.h:236
TableView::handleAspectAboutToBeRemoved
void handleAspectAboutToBeRemoved(const AbstractAspect *aspect, int index)
Definition: TableView.cpp:436
TableView::firstSelectedColumn
int firstSelectedColumn(bool full=false)
Return the index of the first selected column.
Definition: TableView.cpp:802
TableView::goToNextColumn
void goToNextColumn()
Definition: TableView.cpp:963
TableView::d_horizontal_header
TableDoubleHeaderView * d_horizontal_header
Definition: TableView.h:237
TableView::getCurrentCell
void getCurrentCell(int *row, int *col)
Determine the current cell (-1 if no cell is designated as the current)
Definition: TableView.cpp:907
TableDoubleHeaderView
Horizontal header for TableView displaying comments in a second header.
Definition: TableDoubleHeaderView.h:71
future::Table
Aspect providing a spreadsheet table with column logic.
Definition: future_Table.h:86
TableView::lastSelectedColumn
int lastSelectedColumn(bool full=false)
Return the index of the last selected column.
Definition: TableView.cpp:816
Column
Aspect that manages a column.
Definition: Column.h:59
IntervalAttribute< bool >
A class representing an interval-based attribute (bool version)
Definition: IntervalAttribute.h:198
TableView::showComments
void showComments(bool on=true)
Show or hide (if on = false) the column comments.
Definition: TableView.cpp:355
MyWidget
Base class of all MDI client windows.
Definition: MyWidget.h:52
TableView::handleAspectAdded
void handleAspectAdded(const AbstractAspect *aspect)
Definition: TableView.cpp:426
TableView::~TableView
virtual ~TableView()
Destructor.
Definition: TableView.cpp:79
MyWidget::name
virtual QString name()
Return the window name.
Definition: MyWidget.h:81
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:51
TableView::deselectAll
void deselectAll()
Definition: TableView.cpp:313
TableView::eventFilter
bool eventFilter(QObject *watched, QEvent *event)
Definition: TableView.cpp:922
TableView::handleHorizontalHeaderDoubleClicked
void handleHorizontalHeaderDoubleClicked(int index)
Definition: TableView.cpp:339
TableView::d_control_tabs
QWidget * d_control_tabs
Widget that contains the control tabs UI from ui.
Definition: TableView.h:233
TableView::d_table
QPointer< future::Table > d_table
Definition: TableView.h:238
TableView
View class for Table.
Definition: TableView.h:89
globals.h
TableView::changeEvent
virtual void changeEvent(QEvent *event)
Definition: TableView.cpp:253
TableView::updateTypeInfo
void updateTypeInfo()
Definition: TableView.cpp:542
TableView::toggleControlTabBar
void toggleControlTabBar()
Definition: TableView.cpp:318
TableView::selectAll
void selectAll()
Definition: TableView.cpp:308
TableView::selectedRowCount
int selectedRowCount(bool full=false)
Return how many rows are (at least partly) selected.
Definition: TableView.cpp:782
TableView::TableView
TableView(future::Table *table)
Constructor.
Definition: TableView.cpp:64
TableView::setCellsSelected
void setCellsSelected(int first_row, int first_col, int last_row, int last_col, bool select=true)
Select/Deselect a range of cells.
Definition: TableView.cpp:899
TableView::isRowSelected
bool isRowSelected(int row, bool full=false)
Returns true if row 'row' is selected; otherwise false.
Definition: TableView.cpp:794
IntervalAttribute.h
TableView::selectedColumnCount
int selectedColumnCount(bool full=false)
Return how many columns are selected.
Definition: TableView.cpp:738
TableViewWidget::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Overloaded function (cf. Qt documentation)
Definition: TableView.cpp:1007
TableView::applyDescription
void applyDescription()
Definition: TableView.cpp:651
TableView::goToPreviousColumn
void goToPreviousColumn()
Definition: TableView.cpp:974
TableViewWidget::advanceCell
void advanceCell()
TableView::isColumnSelected
bool isColumnSelected(int col, bool full=false)
Returns true if column 'col' is selected; otherwise false.
Definition: TableView.cpp:762
TableView::handleHeaderDataChanged
void handleHeaderDataChanged(Qt::Orientation orientation, int first, int last)
Definition: TableView.cpp:727
TableView::goToCell
void goToCell(int row, int col)
Definition: TableView.cpp:301
TableView::d_delegate
TableItemDelegate * d_delegate
Pointer to the item delegate.
Definition: TableView.h:218
TableView::retranslateStrings
void retranslateStrings()
Definition: TableView.cpp:260
TableView::selectionChanged
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Definition: TableView.cpp:442
TableView::setColumnWidth
void setColumnWidth(int col, int width)
Definition: TableView.cpp:225
TableView::currentColumnChanged
void currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
Definition: TableView.cpp:361
TableView::formulaModeActive
bool formulaModeActive() const
Definition: TableView.cpp:953
TableViewWidget::updateHeaderGeometry
void updateHeaderGeometry(Qt::Orientation o, int first, int last)
Cause a repaint of the header.
Definition: TableView.cpp:997
TableView::showControlFormulaTab
void showControlFormulaTab()
Definition: TableView.cpp:643
TableView::handleFormatLineEditChange
void handleFormatLineEditChange()
Definition: TableView.cpp:611
TableView::updateFormatBox
void updateFormatBox()
Definition: TableView.cpp:448
TableViewWidget::TableViewWidget
TableViewWidget(QWidget *parent=0)
Constructor.
Definition: TableView.h:71
TableView::areCommentsShown
bool areCommentsShown() const
Return whether comments are show currently.
Definition: TableView.cpp:345
TableView::handleAspectDescriptionChanged
void handleAspectDescriptionChanged(const AbstractAspect *aspect)
Definition: TableView.cpp:415
TableView::selectedColumns
QList< Column * > selectedColumns(bool full=false)
Return all selected columns.
Definition: TableView.cpp:770
TableView::columnWidth
int columnWidth(int col) const
Definition: TableView.cpp:230
TableView::firstSelectedRow
int firstSelectedRow(bool full=false)
Return the index of the first selected row.
Definition: TableView.cpp:827
TableView::lastSelectedRow
int lastSelectedRow(bool full=false)
Return the index of the last selected row.
Definition: TableView.cpp:841
TableView::rereadSectionSizes
void rereadSectionSizes()
Definition: TableView.cpp:211
MyWidget.h
TableView::applyType
void applyType()
Definition: TableView.cpp:665
SciDAVis::PlotDesignation
PlotDesignation
Types of plot designations.
Definition: globals.h:55
TableView::showControlTypeTab
void showControlTypeTab()
Definition: TableView.cpp:635
TableView::isCellSelected
bool isCellSelected(int row, int col)
Return whether a cell is selected.
Definition: TableView.cpp:886
TableView::activateFormulaMode
void activateFormulaMode(bool on)
Definition: TableView.cpp:958
TableView::setCellSelected
void setCellSelected(int row, int col, bool select=true)
Select/Deselect a cell.
Definition: TableView.cpp:893
TableViewWidget::selectAll
void selectAll()
Definition: TableView.cpp:988
TableView::isControlTabBarVisible
bool isControlTabBarVisible()
Definition: TableView.h:102
TableView::showControlDescriptionTab
void showControlDescriptionTab()
Definition: TableView.cpp:627
TableItemDelegate
Item delegate for TableView.
Definition: TableItemDelegate.h:37
TableView::handleHorizontalSectionResized
void handleHorizontalSectionResized(int logicalIndex, int oldSize, int newSize)
Definition: TableView.cpp:235
TableView::advanceCell
void advanceCell()
Advance current cell after [Return] or [Enter] was pressed.
Definition: TableView.cpp:287
TableView::selectedRows
IntervalAttribute< bool > selectedRows(bool full=false)
Get the complete set of selected rows.
Definition: TableView.cpp:852
TableView::handleHorizontalSectionMoved
void handleHorizontalSectionMoved(int index, int from, int to)
Definition: TableView.cpp:327
MyWidget::aspect
QString aspect()
Return the window status as a string.
Definition: MyWidget.cpp:106
TableView::d_model
TableModel * d_model
Pointer to the current underlying model.
Definition: TableView.h:220
TableView::init
void init()
Initialization.
Definition: TableView.cpp:92
AbstractAspect
Base class of all persistent objects in a Project.
Definition: AbstractAspect.h:86
TableView::hasMultiSelection
bool hasMultiSelection()
Return whether multiple regions are selected.
Definition: TableView.cpp:864
TableView::ui
Ui::ControlTabs ui
UI with options tabs (description, format, formula etc.)
Definition: TableView.h:229
TableView::d_view_widget
TableViewWidget * d_view_widget
The table view (first part of the UI)
Definition: TableView.h:231
TableView::setColumnForControlTabs
void setColumnForControlTabs(int col)
Definition: TableView.cpp:369