Isis 3 Programmer Reference
Isis::AbstractProjectItemView Class Reference

AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework. More...

#include <AbstractProjectItemView.h>

Inheritance diagram for Isis::AbstractProjectItemView:
Inheritance graph
Collaboration diagram for Isis::AbstractProjectItemView:
Collaboration graph

Public Slots

virtual void addItem (ProjectItem *item)
 Adds an item to the view. More...
 
virtual void addItems (QList< ProjectItem * > items)
 Adds several items to the view. More...
 
virtual void removeItem (ProjectItem *item)
 Removes an item to the view. More...
 
virtual void removeItems (QList< ProjectItem * > items)
 Removes several items from the view. More...
 
virtual void disableActions ()
 Disables toolbars and toolpad actions. More...
 

Signals

void windowChangeEvent (bool event)
 

Public Member Functions

 AbstractProjectItemView (QWidget *parent=0)
 Constructs the AbstractProjectItemView. More...
 
virtual QSize sizeHint () const
 Returns the suggested size. More...
 
virtual void setModel (ProjectItemModel *model)
 Sets the model used by the view. More...
 
virtual ProjectItemModelmodel ()
 Returns the model used by the view. More...
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 Accepts the drag enter event if the internal model can accept the mime data. More...
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 Accepts the drag event if the internal model can accept the mime data. More...
 
virtual void dropEvent (QDropEvent *event)
 Drops the data into the internal model if it can accept the data. More...
 
virtual void moveEvent (QMoveEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void enterEvent (QEvent *event)
 Enables actions when cursor enters the view. More...
 
virtual void leaveEvent (QEvent *event)
 Disables actions when cursor leaves the view. More...
 
virtual void enableActions ()
 Enables toolbars and toolpad actions. More...
 
virtual QList< QAction * > contextMenuActions ()
 Returns a list of actions appropriate for a context menu. More...
 
virtual ProjectItemcurrentItem ()
 Returns the current item of the model. More...
 
virtual QList< ProjectItem * > selectedItems ()
 Return the selected items of the model. More...
 
virtual ProjectItemModelinternalModel ()
 Returns the internal model of the view. More...
 
virtual void setInternalModel (ProjectItemModel *model)
 Sets the internal model of the view. More...
 

Private Attributes

ProjectItemModelm_internalModel
 The internal model used by the view. More...
 

Detailed Description

AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework.

AbstractProjectItemView is not meant to be instantiated directly. A view usually only shows items that have been added to the view. The views contains an internal ProjectItemProxyModel that represents the items appropriately for the view.

When mime data is dropped on a view the view adds the selected items from the source model to the view.

Note that AbstractProjectItemView does not inherit from QAbstractItemView.

Author
2015-10-21 Jeffrey Covington
History:
2015-10-21 Jeffrey Covington - Original version.
History:
2016-06-27 Ian Humphrey - Minor updates to documentation and coding standards. Fixes #4004.
History:
2016-07-28 Tracie Sucharski - Implemented removeItem and removeItems methods.
History:
2016-08-25 Adam Paquette - Minor updates to documentation. Fixes #4299.
History:
2018-05-29 Tracie Sucharski & Summer Stapleton - updated to inherit from QMainWindow instead of QWidget. This updates all views in the ipce main window to be main windows themselves, changing from an mdi interface to an sdi interface.
History:
2018-05-30 Tracie Sucharski - Added the WindowFlag to set this as a Widget.
History:
2018-06-15 Kaitlyn Lee - Removed methods returing toolbar and menu actions because each individual has its own toolbar. These methods are not needed anymore.
History:
2018-06-18 Summer Stapleton - Overloaded moveEvent and resizeEvent and added a windowChangeEvent signal to allow project to recognize a new save state. Fixes #5114
History:
2018-06-25 Kaitlyn Lee - When multiple views are open, there is a possibility of getting ambiguous shortcut errors. To counter this, we need a way to focus on one widget. Giving the views focus did not work completely. Instead, enabling/disabling actions was the best option. Added enableActions(), disableActions(), enterEvent(), and leaveEvent(). On default, a view's actions are disabled. To enable the actions, move the cursor over the view. When a user moves the cursor outside of the view, the actions are disabled.
History:
2018-07-05 Tracie Sucharski - Added SizePolicy and a large sizeHint. The large sizeHint() is because using sizePolicy with a reasonable sizeHint did not work to have views fill the available space in the dock area. References #5433.
History:
2018-07-12 Kaitlyn Lee - Changed the sizeHint to be calculated based on the deskTop size, instead of being hard-coded. The percentages chosen allow for 2 CubeDnViews to be opened at once, since CubeDnView has an internal size policy. References #5433
History:
2018-07-26 Tracie Sucharski - Cleaned up some documentation.
History:
2018-08-10 Tracie Sucharski - Changed addItems method to call the ProjectItemProxyModel::addItems rather than this classes addItem. This speeds things up considerably loading items into the model. References #5296.

Definition at line 79 of file AbstractProjectItemView.h.

Constructor & Destructor Documentation

◆ AbstractProjectItemView()

Isis::AbstractProjectItemView::AbstractProjectItemView ( QWidget parent = 0)

Constructs the AbstractProjectItemView.

Parameters
[in]parent(QMainWindow *) The parent widget

Definition at line 34 of file AbstractProjectItemView.cpp.

References m_internalModel.

Member Function Documentation

◆ addItem

void Isis::AbstractProjectItemView::addItem ( ProjectItem item)
virtualslot

Adds an item to the view.

The item must be part of the view's model. This method can be overridden in a subclass to filter out unneeded items.

Parameters
[in]item(ProjectItem *) The item to add.

Definition at line 250 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by Isis::CubeDnView::addItem().

◆ addItems

void Isis::AbstractProjectItemView::addItems ( QList< ProjectItem * >  items)
virtualslot

Adds several items to the view.

The items must be a part of the view's model. This method can be overridden in a subclass to filter out unneeded items.

Parameters
[in]items(QList<ProjectItem *>) The items to add.

Definition at line 264 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by Isis::CubeDnViewWorkOrder::execute(), and Isis::Footprint2DViewWorkOrder::execute().

◆ contextMenuActions()

QList< QAction * > Isis::AbstractProjectItemView::contextMenuActions ( )
virtual

Returns a list of actions appropriate for a context menu.

Returns
QList<QAction *> The actions

Definition at line 218 of file AbstractProjectItemView.cpp.

◆ currentItem()

ProjectItem * Isis::AbstractProjectItemView::currentItem ( )
virtual

Returns the current item of the model.

Returns
ProjectItem * The item

Definition at line 228 of file AbstractProjectItemView.cpp.

References Isis::ProjectItemModel::currentItem(), and model().

◆ disableActions

void Isis::AbstractProjectItemView::disableActions ( )
virtualslot

◆ dragEnterEvent()

void Isis::AbstractProjectItemView::dragEnterEvent ( QDragEnterEvent *  event)
virtual

Accepts the drag enter event if the internal model can accept the mime data.

Parameters
[in]event(QDragEnterEvent *) The drag event

Definition at line 119 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by Isis::Footprint2DView::eventFilter().

◆ dragMoveEvent()

void Isis::AbstractProjectItemView::dragMoveEvent ( QDragMoveEvent *  event)
virtual

Accepts the drag event if the internal model can accept the mime data.

Parameters
[in]event(QDragMoveEvent *) The drag event

Definition at line 134 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by Isis::Footprint2DView::eventFilter().

◆ dropEvent()

void Isis::AbstractProjectItemView::dropEvent ( QDropEvent *  event)
virtual

Drops the data into the internal model if it can accept the data.

Parameters
[in]event(QDropEvent *) The drop event

Definition at line 148 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by Isis::Footprint2DView::eventFilter().

◆ enableActions()

void Isis::AbstractProjectItemView::enableActions ( )
virtual

Enables toolbars and toolpad actions.

Reimplemented in Isis::Footprint2DView, and Isis::CubeDnView.

Definition at line 206 of file AbstractProjectItemView.cpp.

Referenced by enterEvent().

◆ enterEvent()

void Isis::AbstractProjectItemView::enterEvent ( QEvent *  event)
virtual

Enables actions when cursor enters the view.

Parameters
eventThe enter event

Definition at line 178 of file AbstractProjectItemView.cpp.

References enableActions().

◆ internalModel()

◆ leaveEvent()

void Isis::AbstractProjectItemView::leaveEvent ( QEvent *  event)
virtual

Disables actions when cursor leaves the view.

Parameters
eventThe leave event

Reimplemented in Isis::CubeDnView, and Isis::CnetEditorView.

Definition at line 188 of file AbstractProjectItemView.cpp.

References disableActions().

◆ model()

ProjectItemModel * Isis::AbstractProjectItemView::model ( )
virtual

Returns the model used by the view.

If the internal model is a proxy model, it returns the source model.

Returns
ProjectItemModel * The model.

Definition at line 83 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by currentItem(), Isis::BundleObservationView::displayCsvFile(), selectedItems(), setInternalModel(), Isis::ProjectItemTreeView::setInternalModel(), and setModel().

◆ removeItem

void Isis::AbstractProjectItemView::removeItem ( ProjectItem item)
virtualslot

Removes an item to the view.

The item must be part of the view's model. This method can be overriden in a subclass to filter out unneeded items.

Parameters
[in]item(ProjectItem *) The item to remove.

Definition at line 278 of file AbstractProjectItemView.cpp.

References internalModel().

Referenced by removeItems().

◆ removeItems

void Isis::AbstractProjectItemView::removeItems ( QList< ProjectItem * >  items)
virtualslot

Removes several items from the view.

The items must be a part of the view's model.

Parameters
[in]items(QList<ProjectItem *>) The items to remove.

Definition at line 292 of file AbstractProjectItemView.cpp.

References removeItem().

◆ selectedItems()

QList< ProjectItem * > Isis::AbstractProjectItemView::selectedItems ( )
virtual

Return the selected items of the model.

Returns
QList<ProjectItem *> The items

Definition at line 238 of file AbstractProjectItemView.cpp.

References model(), and Isis::ProjectItemModel::selectedItems().

◆ setInternalModel()

void Isis::AbstractProjectItemView::setInternalModel ( ProjectItemModel model)
virtual

Sets the internal model of the view.

Parameters
[in]model(ProjectItemModel *) The new internal model

Reimplemented in Isis::ProjectItemTreeView.

Definition at line 97 of file AbstractProjectItemView.cpp.

References m_internalModel, and model().

Referenced by Isis::ProjectItemTreeView::setInternalModel().

◆ setModel()

void Isis::AbstractProjectItemView::setModel ( ProjectItemModel model)
virtual

Sets the model used by the view.

If the internal model is a proxy model, it sets the source model.

Parameters
[in]model(ProjectItemModel *) The new model

Definition at line 69 of file AbstractProjectItemView.cpp.

References internalModel(), and model().

Referenced by Isis::Directory::addCubeDnView(), Isis::Directory::addFootprint2DView(), and Isis::Directory::addProjectItemTreeView().

◆ sizeHint()

QSize Isis::AbstractProjectItemView::sizeHint ( ) const
virtual

Returns the suggested size.

Returns
QSize The size hint

Reimplemented in Isis::ProjectItemTreeView, and Isis::ControlHealthMonitorView.

Definition at line 53 of file AbstractProjectItemView.cpp.

Member Data Documentation

◆ m_internalModel

ProjectItemModel* Isis::AbstractProjectItemView::m_internalModel
private

The internal model used by the view.

Definition at line 123 of file AbstractProjectItemView.h.

Referenced by AbstractProjectItemView(), internalModel(), and setInternalModel().


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