Isis 3 Developer Reference
TableViewContent.h
Go to the documentation of this file.
1 #ifndef TableViewContent_H
2 #define TableViewContent_H
3 
4 #include <QAbstractScrollArea>
5 
6 #include <QPoint>
7 #include <QPointer>
8 
9 
10 class QAction;
11 class QEvent;
12 class QKeyEvent;
13 template< typename T > class QList;
14 class QMenu;
15 class QMouseEvent;
16 class QPoint;
17 class QResizeEvent;
18 
19 
20 namespace Isis {
21  class AbstractTreeItem;
22  class AbstractTableModel;
23  class ControlPoint;
24  class TableColumn;
25  class TableColumnList;
26  class TableView;
27 
53  Q_OBJECT
54 
55  public:
57  virtual ~TableViewContent();
58  QSize minimumSizeHint() const;
59  QSize sizeHint() const;
61  // void setModel(AbstractTableModel * someModel);
62  void setActiveControlNet(bool activeNet);
63 
64 
65  signals:
67  void modelDataChanged();
68  void tableSelectionChanged();
71 
72  void editControlPoint(ControlPoint *controlPoint, QString serialNumber);
73 
74 
75  public slots:
77  void scrollTo(AbstractTreeItem *);
78  void refresh();
79  void updateHorizontalScrollBar(bool scrollRight = false);
80 
81 
82  protected:
83  bool eventFilter(QObject *target, QEvent *event);
84  void keyPressEvent(QKeyEvent *event);
85  void leaveEvent(QEvent *event);
86  void mouseDoubleClickEvent(QMouseEvent *event);
87  void mouseMoveEvent(QMouseEvent *event);
88  void mousePressEvent(QMouseEvent *event);
89  void mouseReleaseEvent(QMouseEvent *event);
90  void paintEvent(QPaintEvent *event);
91  void resizeEvent(QResizeEvent *event);
92  void scrollContentsBy(int dx, int dy);
93 
94 
95  private:
96  TableViewContent(const TableViewContent &other);
97  TableViewContent &operator=(const TableViewContent &other);
98 
99 
100  private:
101  void nullify();
102  void cellDataChanged(TableColumn const *col);
103  void clearActiveCell();
104  void clearColumnSelection();
105  void copyCellSelection(bool);
106  void createActions();
107  void selectAllRows();
108  int getColumnFromScreenX(int screenX) const;
109  int getRowFromScreenY(int screenY) const;
110  bool hasActiveCell() const;
111  bool hasRowSelection() const;
112  bool mouseInCellSelection(QPoint) const;
113  bool mouseInRowSelection(QPoint) const;
114  bool rowIsValid(int rowNum) const;
115  bool columnIsValid(int colNum) const;
116  bool cellIsEditable(int, int) const;
117  bool isDataColumn(int) const;
118  void paintRow(QPainter *, int, QPoint, QPoint);
119  void updateActiveCell(QPoint);
120  void updateHoveredCell(QPoint, bool);
121  void updateColumnGroupSelection(AbstractTreeItem *);
122  QList< AbstractTreeItem * > updateRowGroupSelection(int lastRow);
123  void finishEditing();
124  void moveActiveCellDown();
125  void moveActiveCellUp();
126  void moveActiveCellLeft();
127  void moveActiveCellRight();
128 
129 
130  private slots:
131  void copySelection();
132  void copyAll();
133  void deleteSelectedRows();
134  void editControlPoint();
135  void updateItemList();
136  void showContextMenu(QPoint);
137 
138 
139  private:
140  TableView *m_parentView;
141  AbstractTableModel *m_model;
143  TableColumnList *m_columns;
144 
145  QPair< AbstractTreeItem *, int > * m_activeCell;
146 
147  QPair< AbstractTreeItem *, int > * m_lastShiftArrowSelectedCell;
148  bool m_lastShiftArrowDirectionUp;
149 
154  QList< AbstractTreeItem * > * rowsWithActiveColumnSelected;
155 
156  QWidget *m_editWidget;
157 
162  AbstractTreeItem *m_lastDirectlySelectedRow;
163  QList< AbstractTreeItem * > * m_lastShiftSelection;
164  int m_rowHeight;
165 
170  QAction *m_applyToSelectionAct;
171 
176  QAction *m_applyToAllAct;
177 
181  QAction *m_deleteSelectedRowsAct;
182 
186  QAction *m_editControlPointAct;
187 
188  bool m_activeControlNet;
189 
190 
191  private:
192  static const int ITEM_PADDING = 7;
193  static const int ITEM_INDENTATION = 3;
194  };
195 }
196 
197 #endif
virtual ~TableViewContent()
Destructor.
Definition: TableViewContent.cpp:100
void leaveEvent(QEvent *event)
Overrides QWidget::leaveEvent.
Definition: TableViewContent.cpp:545
void scrollTo(QList< AbstractTreeItem * >)
Scrolls to the selected items.
Definition: TableViewContent.cpp:266
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
Definition: TableViewContent.cpp:344
void updateHorizontalScrollBar(bool scrollRight=false)
Updates the horizontal scroll bar.
Definition: TableViewContent.cpp:243
void resizeEvent(QResizeEvent *event)
Updates the table when it is resized.
Definition: TableViewContent.cpp:977
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
Definition: TableViewContent.cpp:479
void refresh()
Refreshes the table and viewport.
Definition: TableViewContent.cpp:216
void paintEvent(QPaintEvent *event)
Paints the table when there is a paint event.
Definition: TableViewContent.cpp:854
void mouseDoubleClickEvent(QMouseEvent *event)
Overrides QWidget::mouseDoubleClickEvent.
Definition: TableViewContent.cpp:317
Definition: TableViewContent.h:52
bool eventFilter(QObject *target, QEvent *event)
Overrides QObject::eventFilter.
Definition: TableViewContent.cpp:307
void rebuildModels(QList< AbstractTreeItem * >)
Translates the tree model into a table model.
Definition: AbstractTableModel.h:40
void horizontalScrollBarValueChanged(int)
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
Definition: TableViewContent.cpp:208
Definition: TableColumn.h:18
Definition: TableColumnList.h:22
A single control point.
Definition: ControlPoint.h:369
Definition: TableView.h:35
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
Definition: TableViewContent.cpp:470
void scrollContentsBy(int dx, int dy)
Updates the item list when the user scrolls.
Definition: TableViewContent.cpp:990
AbstractTableModel * getModel()
Returns the model.
Definition: TableViewContent.cpp:159
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QSize sizeHint() const
Returns the minimum size hint.
Definition: TableViewContent.cpp:149
void editControlPoint(ControlPoint *controlPoint, QString serialNumber)
void keyPressEvent(QKeyEvent *event)
Overrides QWidget::keyPressEvent.
Definition: TableViewContent.cpp:555
Base class for an item in the tree.
Definition: AbstractTreeItem.h:31
Definition: CubeIoHandler.h:39
QSize minimumSizeHint() const
Returns the minimum size hint.
Definition: TableViewContent.cpp:137
TableViewContent(AbstractTableModel *someModel)
Constructor.
Definition: TableViewContent.cpp:43