Isis 3 Programmer Reference
Isis::TableViewContent Class Reference

#include <TableViewContent.h>

Inheritance diagram for Isis::TableViewContent:
Inheritance graph
Collaboration diagram for Isis::TableViewContent:
Collaboration graph

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...
 
AbstractTableModelgetModel ()
 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)
 
TableViewContentoperator= (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

TableViewm_parentView
 
AbstractTableModelm_model
 
QList< QPointer< AbstractTreeItem > > * m_items
 
TableColumnListm_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...
 
QWidgetm_editWidget
 
AbstractTreeItemm_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
 
QActionm_applyToSelectionAct
 This action applies (copies) the contents of the active cell to the current selection. More...
 
QActionm_applyToAllAct
 This action applies (copies) the contents of the active cell to all of the cells in the active cell's column. More...
 
QActionm_deleteSelectedRowsAct
 This action deletes the selected rows. More...
 
QActionm_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
 

Detailed Description

Author
????-??-?? Unknown
History:

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.

Constructor & Destructor Documentation

◆ TableViewContent()

Isis::TableViewContent::TableViewContent ( AbstractTableModel someModel)

Constructor.

Parameters
someModelThe abstract table model

Definition at line 43 of file TableViewContent.cpp.

References createActions(), getModel(), nullify(), refresh(), rowsWithActiveColumnSelected, scrollTo(), showContextMenu(), updateHorizontalScrollBar(), and updateItemList().

◆ ~TableViewContent()

Isis::TableViewContent::~TableViewContent ( )
virtual

Member Function Documentation

◆ cellDataChanged()

void Isis::TableViewContent::cellDataChanged ( TableColumn const *  col)
private

Rebuilds the models when the data is changed.

Parameters
colThe table column that changed

Definition at line 1022 of file TableViewContent.cpp.

Referenced by copyCellSelection(), finishEditing(), and updateActiveCell().

◆ cellIsEditable()

bool Isis::TableViewContent::cellIsEditable ( int  rowNum,
int  colNum 
) const
private

Checks if the cell is editable.

Parameters
rowNumThe cell's row
colNumThe cell's column
Returns
bool True if the cell is selectable and editable

Definition at line 1268 of file TableViewContent.cpp.

Referenced by keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and paintRow().

◆ clearActiveCell()

void Isis::TableViewContent::clearActiveCell ( )
private

Clears the active cell.

Definition at line 1033 of file TableViewContent.cpp.

Referenced by keyPressEvent(), mousePressEvent(), and updateActiveCell().

◆ clearColumnSelection()

void Isis::TableViewContent::clearColumnSelection ( )
private

◆ columnIsValid()

bool Isis::TableViewContent::columnIsValid ( int  colNum) const
private

Checks if the column number is valid.

Parameters
colNumColumn to check
Returns
bool True if the column is greater or equal to 0 and less than m_items->size()

Definition at line 1250 of file TableViewContent.cpp.

◆ copyAll

void Isis::TableViewContent::copyAll ( )
privateslot

Copies all of the cells.

See also
copyCellSelection

Definition at line 1584 of file TableViewContent.cpp.

References copyCellSelection().

Referenced by createActions().

◆ copyCellSelection()

void Isis::TableViewContent::copyCellSelection ( bool  allCells)
private

Copies the selected cells.

Parameters
allCellsDetermines 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().

◆ copySelection

void Isis::TableViewContent::copySelection ( )
privateslot

Copies selected cells.

See also
copyCellSelection

Definition at line 1574 of file TableViewContent.cpp.

References copyCellSelection().

Referenced by createActions().

◆ createActions()

void Isis::TableViewContent::createActions ( )
private

◆ deleteSelectedRows

void Isis::TableViewContent::deleteSelectedRows ( )
privateslot

Deletes the selected rows.

Definition at line 1592 of file TableViewContent.cpp.

Referenced by createActions(), and keyPressEvent().

◆ editControlPoint

void Isis::TableViewContent::editControlPoint ( )
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().

◆ eventFilter()

bool Isis::TableViewContent::eventFilter ( QObject target,
QEvent *  event 
)
protected

Overrides QObject::eventFilter.

Parameters
targetThe object that was changed
eventThe event that was triggered
Returns
bool True if the event is filtered out

Definition at line 307 of file TableViewContent.cpp.

◆ finishEditing()

void Isis::TableViewContent::finishEditing ( )
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().

◆ getColumnFromScreenX()

int Isis::TableViewContent::getColumnFromScreenX ( int  screenX) const
private

Calculates the visible range of a column and returns the index of the column.

Parameters
screenXX value of the screen size
Returns
int Column that fits the screen, or if there aren't any columns that fit -1

Definition at line 1142 of file TableViewContent.cpp.

References Isis::TableColumnList::getVisibleXRange().

Referenced by mouseInCellSelection(), mouseMoveEvent(), mousePressEvent(), moveActiveCellLeft(), and moveActiveCellRight().

◆ getModel()

AbstractTableModel * Isis::TableViewContent::getModel ( )

◆ getRowFromScreenY()

int Isis::TableViewContent::getRowFromScreenY ( int  screenY) const
private

Calculates the visible range of a row and returns the index of the column.

Parameters
screenYY value of the screen size
Returns
int Row that fits the screen, or if there aren't any columns that fit -1

Definition at line 1165 of file TableViewContent.cpp.

Referenced by mouseInCellSelection(), mouseInRowSelection(), and updateActiveCell().

◆ hasActiveCell()

bool Isis::TableViewContent::hasActiveCell ( ) const
private

Checks if there is an active cell.

Returns
bool True if there is an active cell

Definition at line 1181 of file TableViewContent.cpp.

Referenced by copyCellSelection(), keyPressEvent(), and showContextMenu().

◆ hasRowSelection()

bool Isis::TableViewContent::hasRowSelection ( ) const
private

Checks if there is a row selected.

Returns
bool True if there is a row selected

Definition at line 1191 of file TableViewContent.cpp.

Referenced by keyPressEvent(), and showContextMenu().

◆ isDataColumn()

bool Isis::TableViewContent::isDataColumn ( int  colNum) const
private

Checks if the column has a non empty title.

Parameters
colNumThe column to check
Returns
bool True if the column has a non-empty title

Definition at line 1291 of file TableViewContent.cpp.

◆ keyPressEvent()

void Isis::TableViewContent::keyPressEvent ( QKeyEvent *  event)
protected

◆ leaveEvent()

void Isis::TableViewContent::leaveEvent ( QEvent *  event)
protected

Overrides QWidget::leaveEvent.

Parameters
eventQMouseEvent

Definition at line 545 of file TableViewContent.cpp.

◆ minimumSizeHint()

QSize Isis::TableViewContent::minimumSizeHint ( ) const

Returns the minimum size hint.

Returns
QSize Minimum size hint

Definition at line 137 of file TableViewContent.cpp.

Referenced by sizeHint().

◆ mouseDoubleClickEvent()

void Isis::TableViewContent::mouseDoubleClickEvent ( QMouseEvent *  event)
protected

Overrides QWidget::mouseDoubleClickEvent.

Parameters
eventQMouseEvent

Definition at line 317 of file TableViewContent.cpp.

References cellIsEditable().

◆ mouseInCellSelection()

bool Isis::TableViewContent::mouseInCellSelection ( QPoint  mousePos) const
private

Checks if the mouse is in the selected cells.

Parameters
mousePosMouse position
Returns
bool True if the mouse is in the selected cells

Definition at line 1203 of file TableViewContent.cpp.

References getColumnFromScreenX(), getRowFromScreenY(), and rowsWithActiveColumnSelected.

Referenced by showContextMenu().

◆ mouseInRowSelection()

bool Isis::TableViewContent::mouseInRowSelection ( QPoint  mousePos) const
private

Checks if the mouse is in the selected row.

Parameters
mousePosMouse position
Returns
bool True if the mouse is in the selected row

Definition at line 1219 of file TableViewContent.cpp.

References getRowFromScreenY().

Referenced by showContextMenu().

◆ mouseMoveEvent()

void Isis::TableViewContent::mouseMoveEvent ( QMouseEvent *  event)
protected

Overrides QWidget::mouseMoveEvent.

Parameters
eventQMouseEvent

Definition at line 479 of file TableViewContent.cpp.

References cellIsEditable(), clearColumnSelection(), getColumnFromScreenX(), updateColumnGroupSelection(), and updateRowGroupSelection().

◆ mousePressEvent()

void Isis::TableViewContent::mousePressEvent ( QMouseEvent *  event)
protected

◆ mouseReleaseEvent()

void Isis::TableViewContent::mouseReleaseEvent ( QMouseEvent *  event)
protected

Overrides QWidget::mouseReleaseEvent.

Empty function

Parameters
eventQMouseEvent

Definition at line 470 of file TableViewContent.cpp.

◆ moveActiveCellDown()

void Isis::TableViewContent::moveActiveCellDown ( )
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().

◆ moveActiveCellLeft()

void Isis::TableViewContent::moveActiveCellLeft ( )
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().

◆ moveActiveCellRight()

void Isis::TableViewContent::moveActiveCellRight ( )
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().

◆ moveActiveCellUp()

void Isis::TableViewContent::moveActiveCellUp ( )
private

Shifts the active cell up.

Definition at line 778 of file TableViewContent.cpp.

References clearColumnSelection(), and getModel().

Referenced by keyPressEvent().

◆ nullify()

void Isis::TableViewContent::nullify ( )
private

◆ paintEvent()

void Isis::TableViewContent::paintEvent ( QPaintEvent *  event)
protected

Paints the table when there is a paint event.

Overrides QWidget::paintEvent

Parameters
eventThe paint event

Definition at line 854 of file TableViewContent.cpp.

References Isis::TableColumnList::getVisibleXRange(), and paintRow().

◆ paintRow()

void Isis::TableViewContent::paintRow ( QPainter *  painter,
int  rowNum,
QPoint  absolutePosition,
QPoint  relativePosition 
)
private

Repaints the row.

Parameters
painterThe QPainter
rowNumThe row to repaint
absolutePositionThe row position
relativePositionThe 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().

◆ refresh

void Isis::TableViewContent::refresh ( )
slot

◆ resizeEvent()

void Isis::TableViewContent::resizeEvent ( QResizeEvent *  event)
protected

Updates the table when it is resized.

Parameters
eventResize event

Definition at line 977 of file TableViewContent.cpp.

References updateHorizontalScrollBar(), and updateItemList().

◆ rowIsValid()

bool Isis::TableViewContent::rowIsValid ( int  rowNum) const
private

Checks if the row number is valid.

Parameters
rowNumRow to check
Returns
bool True if the row is greater or equal to 0 and less than m_items->size()

Definition at line 1233 of file TableViewContent.cpp.

◆ scrollContentsBy()

void Isis::TableViewContent::scrollContentsBy ( int  dx,
int  dy 
)
protected

Updates the item list when the user scrolls.

Parameters
dxX scroll
dyY scroll

Definition at line 990 of file TableViewContent.cpp.

References updateItemList().

◆ scrollTo [1/2]

void Isis::TableViewContent::scrollTo ( QList< AbstractTreeItem * >  newlySelectedItems)
slot

Scrolls to the selected items.

Parameters
newlySelectedItemsNewly selected items to scroll to

Definition at line 266 of file TableViewContent.cpp.

Referenced by keyPressEvent(), and TableViewContent().

◆ scrollTo [2/2]

void Isis::TableViewContent::scrollTo ( AbstractTreeItem newlySelectedItem)
slot

Scrolls to the selected item.

Parameters
newlySelectedItemNewly selected item to scroll to

Definition at line 278 of file TableViewContent.cpp.

References getModel().

◆ setActiveControlNet()

void Isis::TableViewContent::setActiveControlNet ( bool  activeNet)

Sets if there is an active control net.

Parameters
boolThe 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().

◆ showContextMenu

void Isis::TableViewContent::showContextMenu ( QPoint  mouseLocation)
privateslot

Populates the context menus based on where the user clicked.

Parameters
mouseLocationLocation 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().

◆ sizeHint()

QSize Isis::TableViewContent::sizeHint ( ) const

Returns the minimum size hint.

See also
TableViewContent::minimumSizeHint()
Returns
QSize Minimum size hint

Definition at line 149 of file TableViewContent.cpp.

References minimumSizeHint().

◆ updateActiveCell()

void Isis::TableViewContent::updateActiveCell ( QPoint  screenPos)
private

Updates which cell is active.

Parameters
screenPosThe 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().

◆ updateColumnGroupSelection()

void Isis::TableViewContent::updateColumnGroupSelection ( AbstractTreeItem item)
private

Updates which column is selected.

Parameters
itemThe new selected group

Definition at line 1505 of file TableViewContent.cpp.

References m_lastDirectlySelectedRow, and rowsWithActiveColumnSelected.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ updateHorizontalScrollBar

void Isis::TableViewContent::updateHorizontalScrollBar ( bool  scrollRight = false)
slot

Updates the horizontal scroll bar.

Parameters
scrollRightTrue if the horizontal scroll bar has scrolled right

Definition at line 243 of file TableViewContent.cpp.

Referenced by resizeEvent(), and TableViewContent().

◆ updateItemList

void Isis::TableViewContent::updateItemList ( )
privateslot

Updates the item list.

Definition at line 1647 of file TableViewContent.cpp.

Referenced by refresh(), resizeEvent(), scrollContentsBy(), and TableViewContent().

◆ updateRowGroupSelection()

QList< AbstractTreeItem *> Isis::TableViewContent::updateRowGroupSelection ( int  lastRow)
private

Updates which row is selected.

Parameters
lastRowThe index of the last row
Returns
QList< AbstractTreeItem * > The newly selected row

Definition at line 1535 of file TableViewContent.cpp.

References m_lastDirectlySelectedRow.

Referenced by mouseMoveEvent(), and mousePressEvent().

Member Data Documentation

◆ m_applyToAllAct

QAction* Isis::TableViewContent::m_applyToAllAct
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().

◆ m_applyToSelectionAct

QAction* Isis::TableViewContent::m_applyToSelectionAct
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().

◆ m_deleteSelectedRowsAct

QAction* Isis::TableViewContent::m_deleteSelectedRowsAct
private

This action deletes the selected rows.

Definition at line 181 of file TableViewContent.h.

Referenced by createActions(), nullify(), showContextMenu(), and ~TableViewContent().

◆ m_editControlPointAct

QAction* Isis::TableViewContent::m_editControlPointAct
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().

◆ m_lastDirectlySelectedRow

AbstractTreeItem* Isis::TableViewContent::m_lastDirectlySelectedRow
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().

◆ rowsWithActiveColumnSelected

QList< AbstractTreeItem * >* Isis::TableViewContent::rowsWithActiveColumnSelected
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().


The documentation for this class was generated from the following files: