Isis 3 Programmer Reference
TableViewContent.h
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:
66  void rebuildModels(QList< AbstractTreeItem * >);
67  void modelDataChanged();
68  void tableSelectionChanged();
69  void tableSelectionChanged(QList< AbstractTreeItem * >);
70  void horizontalScrollBarValueChanged(int);
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);
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 
155 
156  QWidget *m_editWidget;
157 
163  QList< AbstractTreeItem * > * m_lastShiftSelection;
164  int m_rowHeight;
165 
171 
177 
182 
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.
void leaveEvent(QEvent *event)
Overrides QWidget::leaveEvent.
void cellDataChanged(TableColumn const *col)
Rebuilds the models when the data is changed.
void scrollTo(QList< AbstractTreeItem * >)
Scrolls to the selected items.
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
void updateHorizontalScrollBar(bool scrollRight=false)
Updates the horizontal scroll bar.
void resizeEvent(QResizeEvent *event)
Updates the table when it is resized.
void copyAll()
Copies all of the cells.
void copyCellSelection(bool)
Copies the selected cells.
void editControlPoint()
Retrieves the control point from the selected cells for editing.
void finishEditing()
Saves the data from the cell the user was modifying.
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
void refresh()
Refreshes the table and viewport.
QAction * m_applyToAllAct
This action applies (copies) the contents of the active cell to all of the cells in the active cell&#39;s...
int getColumnFromScreenX(int screenX) const
Calculates the visible range of a column and returns the index of the column.
void deleteSelectedRows()
Deletes the selected rows.
void moveActiveCellDown()
Changes the viewport when the active cell is moved.
QAction * m_applyToSelectionAct
This action applies (copies) the contents of the active cell to the current selection.
void paintEvent(QPaintEvent *event)
Paints the table when there is a paint event.
void mouseDoubleClickEvent(QMouseEvent *event)
Overrides QWidget::mouseDoubleClickEvent.
bool isDataColumn(int) const
Checks if the column has a non empty title.
bool eventFilter(QObject *target, QEvent *event)
Overrides QObject::eventFilter.
void updateColumnGroupSelection(AbstractTreeItem *)
Updates which column is selected.
Translates the tree model into a table model.
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
bool mouseInCellSelection(QPoint) const
Checks if the mouse is in the selected cells.
A single control point.
Definition: ControlPoint.h:369
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
void copySelection()
Copies selected cells.
bool hasRowSelection() const
Checks if there is a row selected.
void updateActiveCell(QPoint)
Updates which cell is active.
QList< AbstractTreeItem *> updateRowGroupSelection(int lastRow)
Updates which row is selected.
bool cellIsEditable(int, int) const
Checks if the cell is editable.
void moveActiveCellLeft()
Changes the viewport when the active cell is moved.
bool mouseInRowSelection(QPoint) const
Checks if the mouse is in the selected row.
void scrollContentsBy(int dx, int dy)
Updates the item list when the user scrolls.
void clearActiveCell()
Clears the active cell.
AbstractTableModel * getModel()
Returns the model.
void paintRow(QPainter *, int, QPoint, QPoint)
Repaints the row.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
bool columnIsValid(int colNum) const
Checks if the column number is valid.
QSize sizeHint() const
Returns the minimum size hint.
void moveActiveCellUp()
Shifts the active cell up.
void moveActiveCellRight()
Changes the viewport when the active cell is moved.
void keyPressEvent(QKeyEvent *event)
Overrides QWidget::keyPressEvent.
int getRowFromScreenY(int screenY) const
Calculates the visible range of a row and returns the index of the column.
Base class for an item in the tree.
void nullify()
Clears all member variables.
void createActions()
Builds the menus.
QSize minimumSizeHint() const
Returns the minimum size hint.
bool hasActiveCell() const
Checks if there is an active cell.
QAction * m_editControlPointAct
This action edits selected control point or if measure selected, edit parent control pt...
QList< AbstractTreeItem *> * rowsWithActiveColumnSelected
Stores a list of the rows that have their active column cells selected.
void showContextMenu(QPoint)
Populates the context menus based on where the user clicked.
void clearColumnSelection()
Clears the selected column.
AbstractTreeItem * m_lastDirectlySelectedRow
This is the last row that was selected by either a control-click or normal click. ...
bool rowIsValid(int rowNum) const
Checks if the row number is valid.
TableViewContent(AbstractTableModel *someModel)
Constructor.
void updateItemList()
Updates the item list.
QAction * m_deleteSelectedRowsAct
This action deletes the selected rows.