Isis 3 Programmer Reference
|
#include <TableViewContent.h>
Public Slots | |
void | scrollTo (QList< AbstractTreeItem * >) |
Scrolls to the selected items. More... | |
void | scrollTo (AbstractTreeItem *) |
Scrolls to the selected item. More... | |
void | refresh () |
Refreshes the table and viewport. More... | |
void | updateHorizontalScrollBar (bool scrollRight=false) |
Updates the horizontal scroll bar. More... | |
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. More... | |
virtual | ~TableViewContent () |
Destructor. More... | |
QSize | minimumSizeHint () const |
Returns the minimum size hint. More... | |
QSize | sizeHint () const |
Returns the minimum size hint. More... | |
AbstractTableModel * | getModel () |
Returns the model. More... | |
void | setActiveControlNet (bool activeNet) |
Sets if there is an active control net. More... | |
Protected Member Functions | |
bool | eventFilter (QObject *target, QEvent *event) |
Overrides QObject::eventFilter. More... | |
void | keyPressEvent (QKeyEvent *event) |
Overrides QWidget::keyPressEvent. More... | |
void | leaveEvent (QEvent *event) |
Overrides QWidget::leaveEvent. More... | |
void | mouseDoubleClickEvent (QMouseEvent *event) |
Overrides QWidget::mouseDoubleClickEvent. More... | |
void | mouseMoveEvent (QMouseEvent *event) |
Overrides QWidget::mouseMoveEvent. More... | |
void | mousePressEvent (QMouseEvent *event) |
Overrides QWidget::mousePressEvent. More... | |
void | mouseReleaseEvent (QMouseEvent *event) |
Overrides QWidget::mouseReleaseEvent. More... | |
void | paintEvent (QPaintEvent *event) |
Paints the table when there is a paint event. More... | |
void | resizeEvent (QResizeEvent *event) |
Updates the table when it is resized. More... | |
void | scrollContentsBy (int dx, int dy) |
Updates the item list when the user scrolls. More... | |
Private Slots | |
void | copySelection () |
Copies selected cells. More... | |
void | copyAll () |
Copies all of the cells. More... | |
void | deleteSelectedRows () |
Deletes the selected rows. More... | |
void | editControlPoint () |
Retrieves the control point from the selected cells for editing. More... | |
void | updateItemList () |
Updates the item list. More... | |
void | showContextMenu (QPoint) |
Populates the context menus based on where the user clicked. More... | |
Private Member Functions | |
TableViewContent (const TableViewContent &other) | |
TableViewContent & | operator= (const TableViewContent &other) |
void | nullify () |
Clears all member variables. More... | |
void | cellDataChanged (TableColumn const *col) |
Rebuilds the models when the data is changed. More... | |
void | clearActiveCell () |
Clears the active cell. More... | |
void | clearColumnSelection () |
Clears the selected column. More... | |
void | copyCellSelection (bool) |
Copies the selected cells. More... | |
void | createActions () |
Builds the menus. More... | |
void | selectAllRows () |
int | getColumnFromScreenX (int screenX) const |
Calculates the visible range of a column and returns the index of the column. More... | |
int | getRowFromScreenY (int screenY) const |
Calculates the visible range of a row and returns the index of the column. More... | |
bool | hasActiveCell () const |
Checks if there is an active cell. More... | |
bool | hasRowSelection () const |
Checks if there is a row selected. More... | |
bool | mouseInCellSelection (QPoint) const |
Checks if the mouse is in the selected cells. More... | |
bool | mouseInRowSelection (QPoint) const |
Checks if the mouse is in the selected row. More... | |
bool | rowIsValid (int rowNum) const |
Checks if the row number is valid. More... | |
bool | columnIsValid (int colNum) const |
Checks if the column number is valid. More... | |
bool | cellIsEditable (int, int) const |
Checks if the cell is editable. More... | |
bool | isDataColumn (int) const |
Checks if the column has a non empty title. More... | |
void | paintRow (QPainter *, int, QPoint, QPoint) |
Repaints the row. More... | |
void | updateActiveCell (QPoint) |
Updates which cell is active. More... | |
void | updateHoveredCell (QPoint, bool) |
void | updateColumnGroupSelection (AbstractTreeItem *) |
Updates which column is selected. More... | |
QList< AbstractTreeItem *> | updateRowGroupSelection (int lastRow) |
Updates which row is selected. More... | |
void | finishEditing () |
Saves the data from the cell the user was modifying. More... | |
void | moveActiveCellDown () |
Changes the viewport when the active cell is moved. More... | |
void | moveActiveCellUp () |
Shifts the active cell up. More... | |
void | moveActiveCellLeft () |
Changes the viewport when the active cell is moved. More... | |
void | moveActiveCellRight () |
Changes the viewport when the active cell is moved. More... | |
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. More... | |
QWidget * | m_editWidget |
AbstractTreeItem * | m_lastDirectlySelectedRow |
This is the last row that was selected by either a control-click or normal click. More... | |
QList< AbstractTreeItem *> * | m_lastShiftSelection |
int | m_rowHeight |
QAction * | m_applyToSelectionAct |
This action applies (copies) the contents of the active cell to the current selection. More... | |
QAction * | m_applyToAllAct |
This action applies (copies) the contents of the active cell to all of the cells in the active cell's column. More... | |
QAction * | m_deleteSelectedRowsAct |
This action deletes the selected rows. More... | |
QAction * | m_editControlPointAct |
This action edits selected control point or if measure selected, edit parent control pt. More... | |
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 52 of file TableViewContent.h.
Isis::TableViewContent::TableViewContent | ( | AbstractTableModel * | someModel | ) |
Constructor.
someModel | The abstract table model |
Definition at line 43 of file TableViewContent.cpp.
References createActions(), getModel(), nullify(), refresh(), rowsWithActiveColumnSelected, scrollTo(), showContextMenu(), updateHorizontalScrollBar(), and updateItemList().
|
virtual |
Destructor.
Definition at line 100 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 1022 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 1268 of file TableViewContent.cpp.
Referenced by keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and paintRow().
|
private |
Clears the active cell.
Definition at line 1033 of file TableViewContent.cpp.
Referenced by keyPressEvent(), mousePressEvent(), and updateActiveCell().
|
private |
Clears the selected column.
Definition at line 1042 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 1250 of file TableViewContent.cpp.
|
privateslot |
Copies all of the cells.
Definition at line 1584 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 1054 of file TableViewContent.cpp.
References cellDataChanged(), hasActiveCell(), and rowsWithActiveColumnSelected.
Referenced by copyAll(), and copySelection().
|
privateslot |
Copies selected cells.
Definition at line 1574 of file TableViewContent.cpp.
References copyCellSelection().
Referenced by createActions().
|
private |
Builds the menus.
Definition at line 1108 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 1592 of file TableViewContent.cpp.
Referenced by createActions(), and keyPressEvent().
|
privateslot |
Retrieves the control point from the selected cells for editing.
Definition at line 1613 of file TableViewContent.cpp.
References m_lastDirectlySelectedRow.
Referenced by createActions().
|
protected |
Overrides QObject::eventFilter.
target | The object that was changed |
event | The event that was triggered |
Definition at line 307 of file TableViewContent.cpp.
|
private |
Saves the data from the cell the user was modifying.
Definition at line 760 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 1142 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 159 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 1165 of file TableViewContent.cpp.
Referenced by mouseInCellSelection(), mouseInRowSelection(), and updateActiveCell().
|
private |
Checks if there is an active cell.
Definition at line 1181 of file TableViewContent.cpp.
Referenced by copyCellSelection(), keyPressEvent(), and showContextMenu().
|
private |
Checks if there is a row selected.
Definition at line 1191 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 1291 of file TableViewContent.cpp.
|
protected |
Overrides QWidget::keyPressEvent.
event | QMouseEvent |
Definition at line 555 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 545 of file TableViewContent.cpp.
QSize Isis::TableViewContent::minimumSizeHint | ( | ) | const |
Returns the minimum size hint.
Definition at line 137 of file TableViewContent.cpp.
Referenced by sizeHint().
|
protected |
Overrides QWidget::mouseDoubleClickEvent.
event | QMouseEvent |
Definition at line 317 of file TableViewContent.cpp.
References cellIsEditable().
|
private |
Checks if the mouse is in the selected cells.
mousePos | Mouse position |
Definition at line 1203 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 1219 of file TableViewContent.cpp.
References getRowFromScreenY().
Referenced by showContextMenu().
|
protected |
Overrides QWidget::mouseMoveEvent.
event | QMouseEvent |
Definition at line 479 of file TableViewContent.cpp.
References cellIsEditable(), clearColumnSelection(), getColumnFromScreenX(), updateColumnGroupSelection(), and updateRowGroupSelection().
|
protected |
Overrides QWidget::mousePressEvent.
event | QMouseEvent |
Definition at line 344 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 470 of file TableViewContent.cpp.
|
private |
Changes the viewport when the active cell is moved.
Definition at line 798 of file TableViewContent.cpp.
References clearColumnSelection(), and getModel().
Referenced by keyPressEvent().
|
private |
Changes the viewport when the active cell is moved.
Definition at line 819 of file TableViewContent.cpp.
References clearColumnSelection(), and getColumnFromScreenX().
Referenced by keyPressEvent().
|
private |
Changes the viewport when the active cell is moved.
Definition at line 835 of file TableViewContent.cpp.
References clearColumnSelection(), and getColumnFromScreenX().
Referenced by keyPressEvent().
|
private |
Shifts the active cell up.
Definition at line 778 of file TableViewContent.cpp.
References clearColumnSelection(), and getModel().
Referenced by keyPressEvent().
|
private |
Clears all member variables.
Definition at line 999 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 854 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 1305 of file TableViewContent.cpp.
References cellIsEditable(), Isis::ControlPoint::GetRefMeasure(), Isis::TableColumnList::getVisibleXRange(), and rowsWithActiveColumnSelected.
Referenced by paintEvent().
|
slot |
Refreshes the table and viewport.
Definition at line 216 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 977 of file TableViewContent.cpp.
References updateHorizontalScrollBar(), and updateItemList().
|
private |
Checks if the row number is valid.
rowNum | Row to check |
Definition at line 1233 of file TableViewContent.cpp.
|
protected |
Updates the item list when the user scrolls.
dx | X scroll |
dy | Y scroll |
Definition at line 990 of file TableViewContent.cpp.
References updateItemList().
|
slot |
Scrolls to the selected items.
newlySelectedItems | Newly selected items to scroll to |
Definition at line 266 of file TableViewContent.cpp.
Referenced by keyPressEvent(), and TableViewContent().
|
slot |
Scrolls to the selected item.
newlySelectedItem | Newly selected item to scroll to |
Definition at line 278 of file TableViewContent.cpp.
References getModel().
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 208 of file TableViewContent.cpp.
Referenced by Isis::Directory::addCnetEditorView(), and Isis::Directory::newActiveControl().
|
privateslot |
Populates the context menus based on where the user clicked.
mouseLocation | Location of the mouse |
Definition at line 1669 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 149 of file TableViewContent.cpp.
References minimumSizeHint().
|
private |
Updates which cell is active.
screenPos | The position of the active cell |
Definition at line 1452 of file TableViewContent.cpp.
References cellDataChanged(), clearActiveCell(), clearColumnSelection(), getRowFromScreenY(), Isis::TableColumnList::getVisibleXRange(), m_lastDirectlySelectedRow, and Isis::IException::what().
Referenced by mousePressEvent().
|
private |
Updates which column is selected.
item | The new selected group |
Definition at line 1505 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 243 of file TableViewContent.cpp.
Referenced by resizeEvent(), and TableViewContent().
|
privateslot |
Updates the item list.
Definition at line 1647 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 1535 of file TableViewContent.cpp.
References m_lastDirectlySelectedRow.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
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 176 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 170 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
This action deletes the selected rows.
Definition at line 181 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 186 of file TableViewContent.h.
Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().
|
private |
This is the last row that was selected by either a control-click or normal click.
Definition at line 162 of file TableViewContent.h.
Referenced by editControlPoint(), mousePressEvent(), nullify(), refresh(), updateActiveCell(), updateColumnGroupSelection(), and updateRowGroupSelection().
|
private |
Stores a list of the rows that have their active column cells selected.
Definition at line 154 of file TableViewContent.h.
Referenced by clearColumnSelection(), copyCellSelection(), keyPressEvent(), mouseInCellSelection(), mousePressEvent(), nullify(), paintRow(), refresh(), showContextMenu(), TableViewContent(), and updateColumnGroupSelection().