Isis 3 Programmer Reference
|
#include <TableViewContent.h>
Public Slots | |
void | scrollTo (QList< AbstractTreeItem * >) |
Scrolls to the selected items. | |
void | scrollTo (AbstractTreeItem *) |
Scrolls to the selected item. | |
void | refresh () |
Refreshes the table and viewport. | |
void | updateHorizontalScrollBar (bool scrollRight=false) |
Updates the horizontal scroll bar. | |
Signals | |
void | rebuildModels (QList< AbstractTreeItem * >) |
void | modelDataChanged () |
void | tableSelectionChanged () |
void | tableSelectionChanged (QList< AbstractTreeItem * >) |
void | horizontalScrollBarValueChanged (int) |
void | editControlPoint (ControlPoint *controlPoint, QString serialNumber) |
Public Member Functions | |
TableViewContent (AbstractTableModel *someModel) | |
Constructor. | |
virtual | ~TableViewContent () |
Destructor. | |
QSize | minimumSizeHint () const |
Returns the minimum size hint. | |
QSize | sizeHint () const |
Returns the minimum size hint. | |
AbstractTableModel * | getModel () |
Returns the model. | |
void | setActiveControlNet (bool activeNet) |
Sets if there is an active control net. | |
Protected Member Functions | |
bool | eventFilter (QObject *target, QEvent *event) |
Overrides QObject::eventFilter. | |
void | keyPressEvent (QKeyEvent *event) |
Overrides QWidget::keyPressEvent. | |
void | leaveEvent (QEvent *event) |
Overrides QWidget::leaveEvent. | |
void | mouseDoubleClickEvent (QMouseEvent *event) |
Overrides QWidget::mouseDoubleClickEvent. | |
void | mouseMoveEvent (QMouseEvent *event) |
Overrides QWidget::mouseMoveEvent. | |
void | mousePressEvent (QMouseEvent *event) |
Overrides QWidget::mousePressEvent. | |
void | mouseReleaseEvent (QMouseEvent *event) |
Overrides QWidget::mouseReleaseEvent. | |
void | paintEvent (QPaintEvent *event) |
Paints the table when there is a paint event. | |
void | resizeEvent (QResizeEvent *event) |
Updates the table when it is resized. | |
void | scrollContentsBy (int dx, int dy) |
Updates the item list when the user scrolls. | |
Private Slots | |
void | copySelection () |
Copies selected cells. | |
void | copyAll () |
Copies all of the cells. | |
void | deleteSelectedRows () |
Deletes the selected rows. | |
void | editControlPoint () |
Retrieves the control point from the selected cells for editing. | |
void | updateItemList () |
Updates the item list. | |
void | showContextMenu (QPoint) |
Populates the context menus based on where the user clicked. | |
Private Member Functions | |
TableViewContent (const TableViewContent &other) | |
TableViewContent & | operator= (const TableViewContent &other) |
void | nullify () |
Clears all member variables. | |
void | cellDataChanged (TableColumn const *col) |
Rebuilds the models when the data is changed. | |
void | clearActiveCell () |
Clears the active cell. | |
void | clearColumnSelection () |
Clears the selected column. | |
void | copyCellSelection (bool) |
Copies the selected cells. | |
void | createActions () |
Builds the menus. | |
void | selectAllRows () |
int | getColumnFromScreenX (int screenX) const |
Calculates the visible range of a column and returns the index of the column. | |
int | getRowFromScreenY (int screenY) const |
Calculates the visible range of a row and returns the index of the column. | |
bool | hasActiveCell () const |
Checks if there is an active cell. | |
bool | hasRowSelection () const |
Checks if there is a row selected. | |
bool | mouseInCellSelection (QPoint) const |
Checks if the mouse is in the selected cells. | |
bool | mouseInRowSelection (QPoint) const |
Checks if the mouse is in the selected row. | |
bool | rowIsValid (int rowNum) const |
Checks if the row number is valid. | |
bool | columnIsValid (int colNum) const |
Checks if the column number is valid. | |
bool | cellIsEditable (int, int) const |
Checks if the cell is editable. | |
bool | isDataColumn (int) const |
Checks if the column has a non empty title. | |
void | paintRow (QPainter *, int, QPoint, QPoint) |
Repaints the row. | |
void | updateActiveCell (QPoint) |
Updates which cell is active. | |
void | updateHoveredCell (QPoint, bool) |
void | updateColumnGroupSelection (AbstractTreeItem *) |
Updates which column is selected. | |
QList< AbstractTreeItem * > | updateRowGroupSelection (int lastRow) |
Updates which row is selected. | |
void | finishEditing () |
Saves the data from the cell the user was modifying. | |
void | moveActiveCellDown () |
Changes the viewport when the active cell is moved. | |
void | moveActiveCellUp () |
Shifts the active cell up. | |
void | moveActiveCellLeft () |
Changes the viewport when the active cell is moved. | |
void | moveActiveCellRight () |
Changes the viewport when the active cell is moved. | |
Private Attributes | |
TableView * | m_parentView |
AbstractTableModel * | m_model |
QList< QPointer< AbstractTreeItem > > * | m_items |
TableColumnList * | m_columns |
QPair< AbstractTreeItem *, int > * | m_activeCell |
QPair< AbstractTreeItem *, int > * | m_lastShiftArrowSelectedCell |
bool | m_lastShiftArrowDirectionUp |
QList< AbstractTreeItem * > * | rowsWithActiveColumnSelected |
Stores a list of the rows that have their active column cells selected. | |
QWidget * | m_editWidget |
AbstractTreeItem * | m_lastDirectlySelectedRow |
This is the last row that was selected by either a control-click or normal click. | |
QList< AbstractTreeItem * > * | m_lastShiftSelection |
int | m_rowHeight |
QAction * | m_applyToSelectionAct |
This action applies (copies) the contents of the active cell to the current selection. | |
QAction * | m_applyToAllAct |
This action applies (copies) the contents of the active cell to all of the cells in the active cell's column. | |
QAction * | m_deleteSelectedRowsAct |
This action deletes the selected rows. | |
QAction * | m_editControlPointAct |
This action edits selected control point or if measure selected, edit parent control pt. | |
bool | m_activeControlNet |
Static Private Attributes | |
static const int | ITEM_PADDING = 7 |
static const int | ITEM_INDENTATION = 3 |
2012-09-28 Kimberly Oyama - Changed member variables to be prefixed with "m_".
2017-05-18 Tracie Sucharski - Added a new QAction showing on the context menu allowing a control point to be edited in IPCE. Added signal to indicate the control point chosen from either the point table or the measure table. If the point was chosen from the measure table, the serial number of the measure is also passed. This was added for IPCE, for the interaction with other views.
2017-07-18 Christopher Combs - Fixed bug in which trying to edit a selected row would cause a segfault from m_activeCell being null. Fixes #4958.
2017-07-25 Summer Stapleton - Removed the CnetViz namespace. Fixes #5054.
2017-08-08 Makayla Shepherd - Fixed a seg fault in ipce that occurs when attempting to edit a control point when there is not an active control network. Fixes #5048.
2017-09-20 Ian Humphrey - Modified showContextMenu so single line if statements have braces. This prevents a misleading-indentation warning from occuring during Fedora25 (c++14) builds. No functionality has been changed. References #4809.
2018-07-17 Kaitlyn Lee - Modified showContextMenu() to enable m_deleteSelectedRowsAct regardless if an active control is set.
Definition at line 60 of file TableViewContent.h.
Isis::TableViewContent::TableViewContent | ( | AbstractTableModel * | someModel | ) |
Constructor.
someModel | The abstract table model |
Definition at line 49 of file TableViewContent.cpp.
References createActions(), getModel(), nullify(), refresh(), rowsWithActiveColumnSelected, scrollTo(), showContextMenu(), updateHorizontalScrollBar(), and updateItemList().
|
virtual |
Destructor.
Definition at line 105 of file TableViewContent.cpp.
References m_applyToAllAct, m_applyToSelectionAct, m_deleteSelectedRowsAct, and m_editControlPointAct.
|
private |
Rebuilds the models when the data is changed.
col | The table column that changed |
Definition at line 1016 of file TableViewContent.cpp.
Referenced by copyCellSelection(), finishEditing(), and updateActiveCell().
|
private |
Checks if the cell is editable.
rowNum | The cell's row |
colNum | The cell's column |
Definition at line 1259 of file TableViewContent.cpp.
Referenced by keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and paintRow().
|
private |
Clears the active cell.
Definition at line 1027 of file TableViewContent.cpp.
Referenced by keyPressEvent(), mousePressEvent(), and updateActiveCell().
|
private |
Clears the selected column.
Definition at line 1036 of file TableViewContent.cpp.
References rowsWithActiveColumnSelected.
Referenced by keyPressEvent(), mouseMoveEvent(), mousePressEvent(), moveActiveCellDown(), moveActiveCellLeft(), moveActiveCellRight(), moveActiveCellUp(), refresh(), and updateActiveCell().
|
private |
Checks if the column number is valid.
colNum | Column to check |
Definition at line 1241 of file TableViewContent.cpp.
|
privateslot |
Copies all of the cells.
Definition at line 1570 of file TableViewContent.cpp.
References copyCellSelection().
Referenced by createActions().
|
private |
Copies the selected cells.
allCells | Determines if all of the visible rows should be copied |
Definition at line 1047 of file TableViewContent.cpp.
References cellDataChanged(), hasActiveCell(), and rowsWithActiveColumnSelected.
Referenced by copyAll(), and copySelection().
|
privateslot |
Copies selected cells.
Definition at line 1560 of file TableViewContent.cpp.
References copyCellSelection().
Referenced by createActions().
|
private |
Builds the menus.
Definition at line 1099 of file TableViewContent.cpp.
References copyAll(), copySelection(), deleteSelectedRows(), editControlPoint(), m_applyToAllAct, m_applyToSelectionAct, m_deleteSelectedRowsAct, and m_editControlPointAct.
Referenced by TableViewContent().
|
privateslot |
Deletes the selected rows.
Definition at line 1578 of file TableViewContent.cpp.
Referenced by createActions(), and keyPressEvent().
|
privateslot |
Retrieves the control point from the selected cells for editing.
Definition at line 1599 of file TableViewContent.cpp.
References editControlPoint(), and m_lastDirectlySelectedRow.
Referenced by createActions(), and editControlPoint().
|
protected |
Overrides QObject::eventFilter.
target | The object that was changed |
event | The event that was triggered |
Definition at line 311 of file TableViewContent.cpp.
|
private |
Saves the data from the cell the user was modifying.
Definition at line 756 of file TableViewContent.cpp.
References cellDataChanged(), and getModel().
Referenced by keyPressEvent().
|
private |
Calculates the visible range of a column and returns the index of the column.
screenX | X value of the screen size |
Definition at line 1133 of file TableViewContent.cpp.
References Isis::TableColumnList::getVisibleXRange().
Referenced by mouseInCellSelection(), mouseMoveEvent(), mousePressEvent(), moveActiveCellLeft(), and moveActiveCellRight().
AbstractTableModel * Isis::TableViewContent::getModel | ( | ) |
Returns the model.
Definition at line 164 of file TableViewContent.cpp.
Referenced by Isis::TableView::displayWarning(), finishEditing(), Isis::TableView::getModel(), keyPressEvent(), moveActiveCellDown(), moveActiveCellUp(), scrollTo(), and TableViewContent().
|
private |
Calculates the visible range of a row and returns the index of the column.
screenY | Y value of the screen size |
Definition at line 1156 of file TableViewContent.cpp.
Referenced by mouseInCellSelection(), mouseInRowSelection(), and updateActiveCell().
|
private |
Checks if there is an active cell.
Definition at line 1172 of file TableViewContent.cpp.
Referenced by copyCellSelection(), keyPressEvent(), and showContextMenu().
|
private |
Checks if there is a row selected.
Definition at line 1182 of file TableViewContent.cpp.
Referenced by keyPressEvent(), and showContextMenu().
|
private |
Checks if the column has a non empty title.
colNum | The column to check |
Definition at line 1280 of file TableViewContent.cpp.
|
protected |
Overrides QWidget::keyPressEvent.
event | QMouseEvent |
Definition at line 559 of file TableViewContent.cpp.
References cellIsEditable(), clearActiveCell(), clearColumnSelection(), deleteSelectedRows(), finishEditing(), getModel(), hasActiveCell(), hasRowSelection(), moveActiveCellDown(), moveActiveCellLeft(), moveActiveCellRight(), moveActiveCellUp(), rowsWithActiveColumnSelected, and scrollTo().
|
protected |
Overrides QWidget::leaveEvent.
event | QMouseEvent |
Definition at line 549 of file TableViewContent.cpp.
QSize Isis::TableViewContent::minimumSizeHint | ( | ) | const |
Returns the minimum size hint.
Definition at line 142 of file TableViewContent.cpp.
Referenced by sizeHint().
|
protected |
Overrides QWidget::mouseDoubleClickEvent.
event | QMouseEvent |
Definition at line 321 of file TableViewContent.cpp.
References cellIsEditable().
|
private |
Checks if the mouse is in the selected cells.
mousePos | Mouse position |
Definition at line 1194 of file TableViewContent.cpp.
References getColumnFromScreenX(), getRowFromScreenY(), and rowsWithActiveColumnSelected.
Referenced by showContextMenu().
|
private |
Checks if the mouse is in the selected row.
mousePos | Mouse position |
Definition at line 1210 of file TableViewContent.cpp.
References getRowFromScreenY().
Referenced by showContextMenu().
|
protected |
Overrides QWidget::mouseMoveEvent.
event | QMouseEvent |
Definition at line 483 of file TableViewContent.cpp.
References cellIsEditable(), clearColumnSelection(), getColumnFromScreenX(), updateColumnGroupSelection(), and updateRowGroupSelection().
|
protected |
Overrides QWidget::mousePressEvent.
event | QMouseEvent |
Definition at line 348 of file TableViewContent.cpp.
References cellIsEditable(), clearActiveCell(), clearColumnSelection(), getColumnFromScreenX(), m_lastDirectlySelectedRow, rowsWithActiveColumnSelected, updateActiveCell(), updateColumnGroupSelection(), and updateRowGroupSelection().
|
protected |
Overrides QWidget::mouseReleaseEvent.
Empty function
event | QMouseEvent |
Definition at line 474 of file TableViewContent.cpp.
|
private |
Changes the viewport when the active cell is moved.
Definition at line 794 of file TableViewContent.cpp.
References clearColumnSelection(), and getModel().
Referenced by keyPressEvent().
|
private |
Changes the viewport when the active cell is moved.
Definition at line 815 of file TableViewContent.cpp.
References clearColumnSelection(), and getColumnFromScreenX().
Referenced by keyPressEvent().
|
private |
Changes the viewport when the active cell is moved.
Definition at line 831 of file TableViewContent.cpp.
References clearColumnSelection(), and getColumnFromScreenX().
Referenced by keyPressEvent().
|
private |
Shifts the active cell up.
Definition at line 774 of file TableViewContent.cpp.
References clearColumnSelection(), and getModel().
Referenced by keyPressEvent().
|
private |
Clears all member variables.
Definition at line 993 of file TableViewContent.cpp.
References m_applyToAllAct, m_applyToSelectionAct, m_deleteSelectedRowsAct, m_editControlPointAct, m_lastDirectlySelectedRow, and rowsWithActiveColumnSelected.
Referenced by TableViewContent().
|
protected |
Paints the table when there is a paint event.
Overrides QWidget::paintEvent
event | The paint event |
Definition at line 850 of file TableViewContent.cpp.
References Isis::TableColumnList::getVisibleXRange(), and paintRow().
|
private |
Repaints the row.
painter | The QPainter |
rowNum | The row to repaint |
absolutePosition | The row position |
relativePosition | The row position in the visible area |
Definition at line 1294 of file TableViewContent.cpp.
References cellIsEditable(), and rowsWithActiveColumnSelected.
Referenced by paintEvent().
|
slot |
Refreshes the table and viewport.
Definition at line 220 of file TableViewContent.cpp.
References clearColumnSelection(), m_lastDirectlySelectedRow, rowsWithActiveColumnSelected, and updateItemList().
Referenced by Isis::TableView::handleModelSelectionChanged(), and TableViewContent().
|
protected |
Updates the table when it is resized.
event | Resize event |
Definition at line 971 of file TableViewContent.cpp.
References updateHorizontalScrollBar(), and updateItemList().
|
private |
Checks if the row number is valid.
rowNum | Row to check |
Definition at line 1224 of file TableViewContent.cpp.
|
protected |
Updates the item list when the user scrolls.
dx | X scroll |
dy | Y scroll |
Definition at line 984 of file TableViewContent.cpp.
References updateItemList().
|
slot |
Scrolls to the selected item.
newlySelectedItem | Newly selected item to scroll to |
Definition at line 282 of file TableViewContent.cpp.
References getModel().
|
slot |
Scrolls to the selected items.
newlySelectedItems | Newly selected items to scroll to |
Definition at line 270 of file TableViewContent.cpp.
References scrollTo().
Referenced by keyPressEvent(), scrollTo(), and TableViewContent().
void Isis::TableViewContent::setActiveControlNet | ( | bool | activeNet | ) |
Sets if there is an active control net.
bool | The bool if there is an active control net |
Definition at line 212 of file TableViewContent.cpp.
Referenced by Isis::Directory::addCnetEditorView().
|
privateslot |
Populates the context menus based on where the user clicked.
mouseLocation | Location of the mouse |
Definition at line 1654 of file TableViewContent.cpp.
References hasActiveCell(), hasRowSelection(), m_applyToAllAct, m_applyToSelectionAct, m_deleteSelectedRowsAct, m_editControlPointAct, mouseInCellSelection(), mouseInRowSelection(), and rowsWithActiveColumnSelected.
Referenced by TableViewContent().
QSize Isis::TableViewContent::sizeHint | ( | ) | const |
Returns the minimum size hint.
Definition at line 154 of file TableViewContent.cpp.
References minimumSizeHint().
|
private |
Updates which cell is active.
screenPos | The position of the active cell |
Definition at line 1438 of file TableViewContent.cpp.
References cellDataChanged(), clearActiveCell(), clearColumnSelection(), getRowFromScreenY(), Isis::TableColumnList::getVisibleXRange(), and m_lastDirectlySelectedRow.
Referenced by mousePressEvent().
|
private |
Updates which column is selected.
item | The new selected group |
Definition at line 1491 of file TableViewContent.cpp.
References m_lastDirectlySelectedRow, and rowsWithActiveColumnSelected.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
slot |
Updates the horizontal scroll bar.
scrollRight | True if the horizontal scroll bar has scrolled right |
Definition at line 247 of file TableViewContent.cpp.
Referenced by resizeEvent(), and TableViewContent().
|
privateslot |
Updates the item list.
Definition at line 1633 of file TableViewContent.cpp.
Referenced by refresh(), resizeEvent(), scrollContentsBy(), and TableViewContent().
|
private |
Updates which row is selected.
lastRow | The index of the last row |
Definition at line 1521 of file TableViewContent.cpp.
References m_lastDirectlySelectedRow.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
staticprivate |
Definition at line 201 of file TableViewContent.h.
|
staticprivate |
Definition at line 200 of file TableViewContent.h.
|
private |
Definition at line 153 of file TableViewContent.h.
|
private |
Definition at line 196 of file TableViewContent.h.
|
private |
This action applies (copies) the contents of the active cell to all of the cells in the active cell's column.
Definition at line 184 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
This action applies (copies) the contents of the active cell to the current selection.
Definition at line 178 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
Definition at line 151 of file TableViewContent.h.
|
private |
This action deletes the selected rows.
Definition at line 189 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
This action edits selected control point or if measure selected, edit parent control pt.
Definition at line 194 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
Definition at line 164 of file TableViewContent.h.
|
private |
Definition at line 150 of file TableViewContent.h.
|
private |
This is the last row that was selected by either a control-click or normal click.
Definition at line 170 of file TableViewContent.h.
Referenced by editControlPoint(), mousePressEvent(), nullify(), refresh(), updateActiveCell(), updateColumnGroupSelection(), and updateRowGroupSelection().
|
private |
Definition at line 156 of file TableViewContent.h.
|
private |
Definition at line 155 of file TableViewContent.h.
|
private |
Definition at line 171 of file TableViewContent.h.
|
private |
Definition at line 149 of file TableViewContent.h.
|
private |
Definition at line 148 of file TableViewContent.h.
|
private |
Definition at line 172 of file TableViewContent.h.
|
private |
Stores a list of the rows that have their active column cells selected.
Definition at line 162 of file TableViewContent.h.
Referenced by clearColumnSelection(), copyCellSelection(), keyPressEvent(), mouseInCellSelection(), mousePressEvent(), nullify(), paintRow(), refresh(), showContextMenu(), TableViewContent(), and updateColumnGroupSelection().