Isis 3 Programmer Reference
TableViewContent.h
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
18class QAction;
19class QEvent;
20class QKeyEvent;
21template< typename T > class QList;
22class QMenu;
23class QMouseEvent;
24class QPoint;
25class QResizeEvent;
26
27
28namespace 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:
74 void rebuildModels(QList< AbstractTreeItem * >);
75 void modelDataChanged();
76 void tableSelectionChanged();
77 void tableSelectionChanged(QList< AbstractTreeItem * >);
78 void horizontalScrollBarValueChanged(int);
79
80 void editControlPoint(ControlPoint *controlPoint, QString serialNumber);
81
82
83 public slots:
84 void scrollTo(QList< 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:
105 TableViewContent &operator=(const TableViewContent &other);
106
107
108 private:
109 void nullify();
110 void cellDataChanged(TableColumn const *col);
111 void clearActiveCell();
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);
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;
150 QList< QPointer<AbstractTreeItem> > * m_items;
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
171 QList< AbstractTreeItem * > * m_lastShiftSelection;
172 int m_rowHeight;
173
179
185
190
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
Translates the tree model into a table model.
Base class for an item in the tree.
A single control point.
bool hasActiveCell() const
Checks if there is an active cell.
void mouseDoubleClickEvent(QMouseEvent *event)
Overrides QWidget::mouseDoubleClickEvent.
QList< AbstractTreeItem * > updateRowGroupSelection(int lastRow)
Updates which row is selected.
void moveActiveCellDown()
Changes the viewport when the active cell is moved.
int getRowFromScreenY(int screenY) const
Calculates the visible range of a row and returns the index of the column.
void paintEvent(QPaintEvent *event)
Paints the table when there is a paint event.
AbstractTableModel * getModel()
Returns the model.
void clearActiveCell()
Clears the active cell.
void refresh()
Refreshes the table and viewport.
void leaveEvent(QEvent *event)
Overrides QWidget::leaveEvent.
void resizeEvent(QResizeEvent *event)
Updates the table when it is resized.
void scrollTo(QList< AbstractTreeItem * >)
Scrolls to the selected items.
void mousePressEvent(QMouseEvent *event)
Overrides QWidget::mousePressEvent.
void copyCellSelection(bool)
Copies the selected cells.
void updateItemList()
Updates the item list.
void createActions()
Builds the menus.
void updateColumnGroupSelection(AbstractTreeItem *)
Updates which column is selected.
void editControlPoint()
Retrieves the control point from the selected cells for editing.
void finishEditing()
Saves the data from the cell the user was modifying.
QSize sizeHint() const
Returns the minimum size hint.
void copyAll()
Copies all of the cells.
QAction * m_applyToSelectionAct
This action applies (copies) the contents of the active cell to the current selection.
QAction * m_editControlPointAct
This action edits selected control point or if measure selected, edit parent control pt.
void clearColumnSelection()
Clears the selected column.
void cellDataChanged(TableColumn const *col)
Rebuilds the models when the data is changed.
void moveActiveCellRight()
Changes the viewport when the active cell is moved.
QAction * m_deleteSelectedRowsAct
This action deletes the selected rows.
void updateHorizontalScrollBar(bool scrollRight=false)
Updates the horizontal scroll bar.
bool eventFilter(QObject *target, QEvent *event)
Overrides QObject::eventFilter.
bool rowIsValid(int rowNum) const
Checks if the row number is valid.
AbstractTreeItem * m_lastDirectlySelectedRow
This is the last row that was selected by either a control-click or normal click.
bool cellIsEditable(int, int) const
Checks if the cell is editable.
void moveActiveCellLeft()
Changes the viewport when the active cell is moved.
void deleteSelectedRows()
Deletes the selected rows.
void updateActiveCell(QPoint)
Updates which cell is active.
QSize minimumSizeHint() const
Returns the minimum size hint.
QAction * m_applyToAllAct
This action applies (copies) the contents of the active cell to all of the cells in the active cell's...
TableViewContent(AbstractTableModel *someModel)
Constructor.
bool hasRowSelection() const
Checks if there is a row selected.
void paintRow(QPainter *, int, QPoint, QPoint)
Repaints the row.
bool columnIsValid(int colNum) const
Checks if the column number is valid.
QList< AbstractTreeItem * > * rowsWithActiveColumnSelected
Stores a list of the rows that have their active column cells selected.
void keyPressEvent(QKeyEvent *event)
Overrides QWidget::keyPressEvent.
void copySelection()
Copies selected cells.
void nullify()
Clears all member variables.
bool isDataColumn(int) const
Checks if the column has a non empty title.
void moveActiveCellUp()
Shifts the active cell up.
void mouseReleaseEvent(QMouseEvent *event)
Overrides QWidget::mouseReleaseEvent.
void mouseMoveEvent(QMouseEvent *event)
Overrides QWidget::mouseMoveEvent.
void showContextMenu(QPoint)
Populates the context menus based on where the user clicked.
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.
virtual ~TableViewContent()
Destructor.
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
int getColumnFromScreenX(int screenX) const
Calculates the visible range of a column and returns the index of the column.
bool mouseInCellSelection(QPoint) const
Checks if the mouse is in the selected cells.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16