Isis Developer Reference
TableViewContent.h
Go to the documentation of this file.
1 #ifndef TableViewContent_H
2 #define TableViewContent_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QAbstractScrollArea>
13 
14 #include <QPoint>
15 #include <QPointer>
16 
17 
18 class QAction;
19 class QEvent;
20 class QKeyEvent;
21 template< typename T > class QList;
22 class QMenu;
23 class QMouseEvent;
24 class QPoint;
25 class QResizeEvent;
26 
27 
28 namespace Isis {
29  class AbstractTreeItem;
30  class AbstractTableModel;
31  class ControlPoint;
32  class TableColumn;
33  class TableColumnList;
34  class TableView;
35 
61  Q_OBJECT
62 
63  public:
65  virtual ~TableViewContent();
66  QSize minimumSizeHint() const;
67  QSize sizeHint() const;
69  // void setModel(AbstractTableModel * someModel);
70  void setActiveControlNet(bool activeNet);
71 
72 
73  signals:
79 
80  void editControlPoint(ControlPoint *controlPoint, QString serialNumber);
81 
82 
83  public slots:
85  void scrollTo(AbstractTreeItem *);
86  void refresh();
87  void updateHorizontalScrollBar(bool scrollRight = false);
88 
89 
90  protected:
91  bool eventFilter(QObject *target, QEvent *event);
92  void keyPressEvent(QKeyEvent *event);
93  void leaveEvent(QEvent *event);
94  void mouseDoubleClickEvent(QMouseEvent *event);
95  void mouseMoveEvent(QMouseEvent *event);
96  void mousePressEvent(QMouseEvent *event);
97  void mouseReleaseEvent(QMouseEvent *event);
98  void paintEvent(QPaintEvent *event);
99  void resizeEvent(QResizeEvent *event);
100  void scrollContentsBy(int dx, int dy);
101 
102 
103  private:
104  TableViewContent(const TableViewContent &other);
105  TableViewContent &operator=(const TableViewContent &other);
106 
107 
108  private:
109  void nullify();
110  void cellDataChanged(TableColumn const *col);
111  void clearActiveCell();
112  void clearColumnSelection();
113  void copyCellSelection(bool);
114  void createActions();
115  void selectAllRows();
116  int getColumnFromScreenX(int screenX) const;
117  int getRowFromScreenY(int screenY) const;
118  bool hasActiveCell() const;
119  bool hasRowSelection() const;
120  bool mouseInCellSelection(QPoint) const;
121  bool mouseInRowSelection(QPoint) const;
122  bool rowIsValid(int rowNum) const;
123  bool columnIsValid(int colNum) const;
124  bool cellIsEditable(int, int) const;
125  bool isDataColumn(int) const;
126  void paintRow(QPainter *, int, QPoint, QPoint);
127  void updateActiveCell(QPoint);
128  void updateHoveredCell(QPoint, bool);
129  void updateColumnGroupSelection(AbstractTreeItem *);
130  QList< AbstractTreeItem * > updateRowGroupSelection(int lastRow);
131  void finishEditing();
132  void moveActiveCellDown();
133  void moveActiveCellUp();
134  void moveActiveCellLeft();
135  void moveActiveCellRight();
136 
137 
138  private slots:
139  void copySelection();
140  void copyAll();
141  void deleteSelectedRows();
142  void editControlPoint();
143  void updateItemList();
144  void showContextMenu(QPoint);
145 
146 
147  private:
148  TableView *m_parentView;
149  AbstractTableModel *m_model;
151  TableColumnList *m_columns;
152 
153  QPair< AbstractTreeItem *, int > * m_activeCell;
154 
155  QPair< AbstractTreeItem *, int > * m_lastShiftArrowSelectedCell;
156  bool m_lastShiftArrowDirectionUp;
157 
162  QList< AbstractTreeItem * > * rowsWithActiveColumnSelected;
163 
164  QWidget *m_editWidget;
165 
170  AbstractTreeItem *m_lastDirectlySelectedRow;
171  QList< AbstractTreeItem * > * m_lastShiftSelection;
172  int m_rowHeight;
173 
178  QAction *m_applyToSelectionAct;
179 
184  QAction *m_applyToAllAct;
185 
189  QAction *m_deleteSelectedRowsAct;
190 
194  QAction *m_editControlPointAct;
195 
196  bool m_activeControlNet;
197 
198 
199  private:
200  static const int ITEM_PADDING = 7;
201  static const int ITEM_INDENTATION = 3;
202  };
203 }
204 
205 #endif
Isis::AbstractTreeItem::getData
virtual QVariant getData() const =0
Isis::TableViewContent::paintEvent
void paintEvent(QPaintEvent *event)
Paints the table when there is a paint event.
Definition: TableViewContent.cpp:862
QAbstractScrollArea
Isis::TableViewContent::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
Definition: TableViewContent.cpp:487
Isis::AbstractTableModel::getDelegate
virtual const AbstractTableDelegate * getDelegate() const
Definition: AbstractTableModel.cpp:164
Isis::AbstractTreeItem::Point
@ Point
Definition: AbstractTreeItem.h:46
Isis::TableViewContent::modelDataChanged
void modelDataChanged()
QWidget
Isis::TableColumnList::size
int size() const
Definition: TableColumnList.cpp:166
Isis::AbstractTreeItem::parent
AbstractTreeItem * parent() const
Definition: AbstractTreeItem.cpp:46
TableColumn.h
TableViewContent.h
Isis::AbstractTableModel::indexOfVisibleItem
virtual int indexOfVisibleItem(AbstractTreeItem const *item) const =0
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
QMenu
Isis::TableViewContent::editControlPoint
void editControlPoint(ControlPoint *controlPoint, QString serialNumber)
Isis::AbstractTreeItem::Measure
@ Measure
Definition: AbstractTreeItem.h:47
AbstractTableModel.h
Isis::TableViewContent::leaveEvent
void leaveEvent(QEvent *event)
Overrides QWidget::leaveEvent.
Definition: TableViewContent.cpp:553
Isis::AbstractTableDelegate::readData
virtual void readData(QWidget *, AbstractTreeItem *, TableColumn const *) const =0
Isis::TableView
Definition: TableView.h:43
Isis::TableViewContent::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
Definition: TableViewContent.cpp:352
AbstractTableDelegate.h
Isis::TableColumn
Definition: TableColumn.h:26
Isis::TableColumnList::getVisibleColumns
TableColumnList getVisibleColumns()
Definition: TableColumnList.cpp:204
Isis::TableViewContent::scrollTo
void scrollTo(QList< AbstractTreeItem * >)
Scrolls to the selected items.
Definition: TableViewContent.cpp:274
Isis::AbstractTableModel
Translates the tree model into a table model.
Definition: AbstractTableModel.h:48
IString.h
Isis::AbstractTableModel::getItems
virtual QList< AbstractTreeItem * > getItems(int, int)=0
Isis::AbstractTreeItem::setSelected
virtual void setSelected(bool newState)
Definition: AbstractTreeItem.cpp:126
Isis::AbstractTreeItem::isSelected
virtual bool isSelected() const
Definition: AbstractTreeItem.cpp:136
Isis::AbstractTableDelegate::getWidget
virtual QWidget * getWidget(TableColumn const *) const =0
Isis::ControlPoint
A single control point.
Definition: ControlPoint.h:354
Isis::TableViewContent::resizeEvent
void resizeEvent(QResizeEvent *event)
Updates the table when it is resized.
Definition: TableViewContent.cpp:985
Isis::TableViewContent::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Overrides QWidget::keyPressEvent.
Definition: TableViewContent.cpp:563
Isis::TableColumnList
Definition: TableColumnList.h:30
Isis::TableViewContent::getModel
AbstractTableModel * getModel()
Returns the model.
Definition: TableViewContent.cpp:167
Isis::AbstractTableDelegate::saveData
virtual void saveData(QWidget *, AbstractTreeItem *, TableColumn const *) const =0
AbstractTreeItem.h
Isis::AbstractTreeItem::getChildren
virtual QList< AbstractTreeItem * > getChildren() const =0
Isis::TableViewContent::sizeHint
QSize sizeHint() const
Returns the minimum size hint.
Definition: TableViewContent.cpp:157
Isis::AbstractTableModel::getColumns
virtual TableColumnList * getColumns()
Definition: AbstractTableModel.cpp:154
Isis::TableColumnList::getVisibleXRange
QPair< int, int > getVisibleXRange(int visibleColumn)
Definition: TableColumnList.cpp:184
Isis::TableViewContent::tableSelectionChanged
void tableSelectionChanged()
Isis::TableViewContent::TableViewContent
TableViewContent(AbstractTableModel *someModel)
Constructor.
Definition: TableViewContent.cpp:51
ControlPoint.h
Isis::AbstractTableModel::getVisibleRowCount
virtual int getVisibleRowCount() const =0
Isis::TableViewContent::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event)
Overrides QWidget::mouseDoubleClickEvent.
Definition: TableViewContent.cpp:325
Isis::TableColumn::getTitle
QString getTitle() const
Definition: TableColumn.cpp:49
Isis::TableViewContent::~TableViewContent
virtual ~TableViewContent()
Destructor.
Definition: TableViewContent.cpp:108
Isis::TableViewContent::minimumSizeHint
QSize minimumSizeHint() const
Returns the minimum size hint.
Definition: TableViewContent.cpp:145
ASSERT
#define ASSERT(x)
Definition: IsisDebug.h:134
Isis::AbstractTableModel::getWarningMessage
virtual QString getWarningMessage(AbstractTreeItem const *, TableColumn const *, QString valueToSave) const =0
Isis::AbstractTableModel::getSelectedItems
virtual QList< AbstractTreeItem * > getSelectedItems()=0
Isis::TableViewContent::eventFilter
bool eventFilter(QObject *target, QEvent *event)
Overrides QObject::eventFilter.
Definition: TableViewContent.cpp:315
IException.h
Isis::TableViewContent::updateHorizontalScrollBar
void updateHorizontalScrollBar(bool scrollRight=false)
Updates the horizontal scroll bar.
Definition: TableViewContent.cpp:251
QPair
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:23
Isis::TableViewContent::tableSelectionChanged
void tableSelectionChanged(QList< AbstractTreeItem * >)
Isis::TableViewContent::setActiveControlNet
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
Definition: TableViewContent.cpp:216
Isis::AbstractTableDelegate
Base class for delegates which create, read, and save data in the tables.
Definition: AbstractTableDelegate.h:33
Isis::AbstractTreeItem::getPointerType
virtual InternalPointerType getPointerType() const =0
Isis::AbstractTableModel::setGlobalSelection
virtual void setGlobalSelection(bool selected)=0
Isis::TableViewContent::rebuildModels
void rebuildModels(QList< AbstractTreeItem * >)
Isis::TableColumnList::getVisibleWidth
int getVisibleWidth() const
Definition: TableColumnList.cpp:228
QObject
Isis::TableViewContent::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
Definition: TableViewContent.cpp:478
Isis::TableViewContent::horizontalScrollBarValueChanged
void horizontalScrollBarValueChanged(int)
IsisDebug.h
QAction
Isis::TableViewContent::refresh
void refresh()
Refreshes the table and viewport.
Definition: TableViewContent.cpp:224
TableColumnList.h
Isis::AbstractTreeItem
Base class for an item in the tree.
Definition: AbstractTreeItem.h:39
ControlMeasure.h
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::AbstractTableModel::isFiltering
virtual bool isFiltering() const
Definition: AbstractTableModel.cpp:118
Isis::TableViewContent
Definition: TableViewContent.h:60
Isis::TableViewContent::scrollContentsBy
void scrollContentsBy(int dx, int dy)
Updates the item list when the user scrolls.
Definition: TableViewContent.cpp:998