Isis 3 Programmer Reference
Isis::ProjectItemProxyModel Class Reference

Allows access to items in a ProjectItemModel through a proxy model. More...

#include <ProjectItemProxyModel.h>

Inheritance diagram for Isis::ProjectItemProxyModel:
Inheritance graph
Collaboration diagram for Isis::ProjectItemProxyModel:
Collaboration graph

Public Slots

ProjectItemaddItem (ProjectItem *sourceItem)
 Adds an item and its children to the proxy model. More...
 
void addItems (QList< ProjectItem * > sourceItems)
 Adds a list of items to the proxy model. More...
 

Signals

void itemsAdded ()
 
void itemRemoved (ProjectItem *)
 
void itemAdded (ProjectItem *)
 This signal is emitted when a ProjectItem is added to the model. More...
 
void cleanProject (bool)
 This signal is emitted whrn a ProjectItem's name is changed. More...
 
void projectNameEdited (QString)
 This signal is emitted when the project name is edited. More...
 

Public Member Functions

 ProjectItemProxyModel (QObject *parent=0)
 Constructs the proxy model. More...
 
QModelIndex mapIndexFromSource (const QModelIndex &sourceIndex)
 Returns the QModelIndex of an item in the proxy model that corresponds with the QModelIndex of an item in the source model. More...
 
QModelIndex mapIndexToSource (const QModelIndex &proxyIndex)
 Returns the QModelIndex of an item in the souce model that corresponds with the QModelIndex of an item in the proxy model. More...
 
QItemSelection mapSelectionFromSource (const QItemSelection &sourceSelection)
 Returns a QItemSelection of items in the proxy model that corresponds with a QItemSelection of items in the source model. More...
 
QItemSelection mapSelectionToSource (const QItemSelection &proxySelection)
 Returns a QItemSelection of items in the source model that corresponds with a QItemSelection of itesm in the proxy model. More...
 
ProjectItemmapItemFromSource (ProjectItem *sourceItem)
 Returns the ProjectItem in the proxy model that corresponds with a ProjectItem in the source model. More...
 
ProjectItemmapItemToSource (ProjectItem *proxyItem)
 Returns the ProjectItem in the source model that corresponds with a ProjectItem in the source model. More...
 
void removeItem (ProjectItem *item)
 Removes an item and its children from the proxy model. More...
 
void setSourceModel (ProjectItemModel *sourceModel)
 Sets the source model. More...
 
ProjectItemModelsourceModel ()
 Returns the source model. More...
 
virtual bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
 Returns true. More...
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 Adds the data (selected items) from the source model to the proxy model. More...
 
QItemSelectionModel * selectionModel ()
 Returns the internal selection model. More...
 
ProjectItemaddProject (Project *project)
 Adds a Project to the model. More...
 
ProjectItemfindItemData (const QVariant &data, int role=Qt::UserRole+1)
 Returns the first item found that contains the given data in the given role or a null pointer if no item is found. More...
 
virtual void removeItems (QList< ProjectItem * > items)
 Removes a list of items and their children from the model. More...
 
ProjectItemcurrentItem ()
 Returns the current item of the internal selection model. More...
 
QList< ProjectItem * > selectedItems ()
 Returns a list of the selected items of the internal selection model. More...
 
QList< ProjectItem * > selectedBOSSImages ()
 ProjectItemModel::selectedBOSSImages. More...
 
void appendRow (ProjectItem *item)
 Appends a top-level item to the model. More...
 
void clean ()
 Used to clean the ProjectItemModel of everything but the headers. More...
 
QModelIndex indexFromItem (const ProjectItem *item)
 Returns the QModelIndex corresponding to a given ProjectItem. More...
 
void insertRow (int row, ProjectItem *item)
 Inserts a top-level item at the given row. More...
 
ProjectItemitem (int row)
 Returns the top-level item at the given row. More...
 
ProjectItemitemFromIndex (const QModelIndex &index)
 Returns the ProjectItem corresponding to a given QModelIndex. More...
 
void setItem (int row, ProjectItem *item)
 Sets the item at the top-level row. More...
 
ProjectItemtakeItem (int row)
 Removes the top-level row and returns the removed item. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role)
 This virtual method was added to handle changing the project name by double-clicking the project name on the project tree. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const
 This virtual method was added to handle changing the project name by double-clicking the project name on the project tree. More...
 

Protected Slots

void updateItem (ProjectItem *sourceItem)
 Given an item in the source model, this method changes the data of the corresponding item in the proxy model to match that of the item in the source model. More...
 
void updateProxyCurrent ()
 Slot that updates the current item in the proxy model only if it is different than the corresponding item in the source model. More...
 
void updateSourceCurrent ()
 Slot that updates the current item in the proxy model only if it is different than the corresponding item in the source model. More...
 
void updateProxySelection ()
 Slot that updates the selection in the proxy model only if it is different than the corresponding selection in the source model. More...
 
void updateSourceSelection ()
 Slot that updates the selection in the source model only if it is different than the corresponding selection in the proxy model. More...
 
void onSelectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 Slot to connect to the selectionChanged() signal from a selection model. More...
 

Protected Member Functions

ProjectItemaddChild (ProjectItem *sourceItem, ProjectItem *parentItem)
 Creates an item in the proxy model corresponding to an item in the source model as a child of a parent item in the proxy model. More...
 

Private Slots

void onItemChanged (QStandardItem *item)
 Signal to connect to the itemChanged() signal from a ProjectItemModel. More...
 
void onNameChanged (QString newName)
 Slot to connect to the nameChanged() signal from a Project. More...
 
void onBundleSolutionInfoAdded (BundleSolutionInfo *bundleSolutionInfo)
 Slot to connect to the bundleSolutionInfoAdded() signal from a project. More...
 
void onImagesAdded (ImageList *images)
 Slot to connect to the imagesAdded() signal from a Project. More...
 
void onShapesAdded (ShapeList *shapes)
 Slot to connect to the shapesAdded() signal from a Project. More...
 
void onControlAdded (Control *control)
 Slot to connect to the controlAdded() signal from a project. More...
 
void onControlListAdded (ControlList *controlList)
 Slot to connect to the controlListAdded() signal from a Project. More...
 
void onTargetsAdded (TargetBodyList *targets)
 Slot to connect to the targetsAdded() signal from a Project. More...
 
void onTemplatesAdded (TemplateList *templateList)
 Slot connected to the templatesAdded() signal from a project. More...
 
void onGuiCamerasAdded (GuiCameraList *cameras)
 Slot to connect to the guiCamerasAdded() signal from a Project. More...
 
void onRowsInserted (const QModelIndex &parent, int start, int end)
 Slot to connect to the rowsInserted() signal from QAbstractItemModel. More...
 
void onRowsRemoved (const QModelIndex &parent, int start, int end)
 Slot to connect to the rowsAboutToBeRemoved() signal from QAbstractItemModel. More...
 

Private Member Functions

bool rejectName (QStringList &reserved, QString target)
 Checks to see if we are adding a reserved name to the project (ex. More...
 

Private Attributes

ProjectItemModelm_sourceModel
 The source model. Map of items from the source model to the proxy model. More...
 
QMap< ProjectItem *, ProjectItem * > m_sourceProxyMap
 
QItemSelectionModel * m_selectionModel
 The internal selection model. More...
 
QStringList m_reservedNames
 

Detailed Description

Allows access to items in a ProjectItemModel through a proxy model.

A proxy model can have a different structure than the source model. An item in the proxy model usually corresponds to an item in the source model. The proxy model will update item selections and the current item between the source model and the proxy model.

In the default implementation the only items in the proxy model are item that are added with the addItem() method. The items that are added are organized in the same tree structure that they are in the source model. Subclasses of ProjectItemProxyModel can organize items in a different way by overriding the addItem() method.

The proxy model ensures that its item selection corresponds to the item selection in the source model. When the selection in the proxy model changes the selection in the source model is changed to the items that correspond to the items in the proxy selection. Similarly when the selection in the source model is changed the selection in the proxy model is changed to the items in the proxy model that correpond to the items in the selection.

model->addProject(project);
proxyModel->setSourceModel(model);
for (int i=0; i < model.rowCount(); i++) {
proxyModel->addItem( model->item(i) );
}
Author
2015-10-21 Jeffrey Covington
History:
2015-10-21 Jeffrey Covington - Original version.
History:
2016-01-13 Jeffrey Covington - Added canDropMimeData() and dropMimeData() methods.
History:
2016-06-27 Ian Humphrey - Added documentation to the canDropMimeData() and dropMimeData() methods. Checked coding standards. Fixes #4006.
History:
2016-08-11 Tracie Sucharski - Added itemRemoved signal.
History:
2016-08-25 Adam Paquette - Updated documentation. Fixes #4299.
History:
2018-08-10 Tracie Sucharski - Added itemsAdded signal to indicate that all items in a list have been added to the model. References #5296.

Definition at line 70 of file ProjectItemProxyModel.h.

Constructor & Destructor Documentation

◆ ProjectItemProxyModel()

Isis::ProjectItemProxyModel::ProjectItemProxyModel ( QObject parent = 0)

Constructs the proxy model.

Parameters
[in]parent(QObject *) The parent QObject.

Definition at line 30 of file ProjectItemProxyModel.cpp.

References m_sourceModel.

Member Function Documentation

◆ addChild()

ProjectItem * Isis::ProjectItemProxyModel::addChild ( ProjectItem sourceItem,
ProjectItem parentItem 
)
protected

Creates an item in the proxy model corresponding to an item in the source model as a child of a parent item in the proxy model.

If the corresponding item in the proxy model already exits then that item is updated instead of creating a new item. If the corresponding item already has a parent its parent is changed to the new parent. If the parent item is null then the item is added as a top-level item in the model.

Parameters
[in]sourceItem(ProjectItem *) The item in the source model.
[in]parentItem(ProjectItem *) The parent in the proxy model.
Returns
ProjectItem* The correponding item in the proxy model.

Definition at line 351 of file ProjectItemProxyModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItemModel::appendRow(), mapItemFromSource(), Isis::ProjectItem::model(), Isis::ProjectItem::parent(), Isis::ProjectItem::setProjectItem(), setSourceModel(), and sourceModel().

Referenced by addItem().

◆ addItem

ProjectItem * Isis::ProjectItemProxyModel::addItem ( ProjectItem sourceItem)
slot

Adds an item and its children to the proxy model.

Creates items in the proxy model from an item in the source model and returns the created item. If the item in the source model has already been added, then the corresponding item in the proxy model is updated and returned instead.

When an item in the source model is added the children of that item are also added as children of the corresponding item in the proxy model.

Parameters
[in]sourceItem(ProjectItem *) The item in the source model.
Returns
ProjectItem* The item in the proxy model.

Definition at line 167 of file ProjectItemProxyModel.cpp.

References addChild(), Isis::ProjectItem::child(), mapItemFromSource(), and Isis::ProjectItem::parent().

Referenced by addItems().

◆ addItems

void Isis::ProjectItemProxyModel::addItems ( QList< ProjectItem * >  sourceItems)
slot

Adds a list of items to the proxy model.

Parameters
[in]sourceItem(QList<ProjectItem *>) The list of items in the source model.

Definition at line 195 of file ProjectItemProxyModel.cpp.

References addItem(), and Isis::ProjectItemModel::item().

Referenced by dropMimeData().

◆ addProject()

ProjectItem * Isis::ProjectItemModel::addProject ( Project project)
inherited

◆ appendRow()

void Isis::ProjectItemModel::appendRow ( ProjectItem item)
inherited

Appends a top-level item to the model.

Parameters
item(ProjectItem *) The item to append.

Definition at line 354 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item().

Referenced by addChild(), and Isis::ProjectItemModel::addProject().

◆ canDropMimeData()

bool Isis::ProjectItemProxyModel::canDropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
) const
virtual

Returns true.

You can drop data into a ProjectItemProxyModel

Parameters
data(const QMimeData *) The data to drop
action(Qt::DropAction) The drop action
row(int) ???
column(int)???
QModelIndex(const QModelIndex &) Index of the data's parent item
Returns
bool True if the proxy model can accept the mime data.

Reimplemented from Isis::ProjectItemModel.

Definition at line 418 of file ProjectItemProxyModel.cpp.

◆ clean()

void Isis::ProjectItemModel::clean ( )
inherited

◆ cleanProject

void Isis::ProjectItemModel::cleanProject ( bool  )
signalinherited

This signal is emitted whrn a ProjectItem's name is changed.

Referenced by Isis::ProjectItemModel::setData().

◆ currentItem()

ProjectItem * Isis::ProjectItemModel::currentItem ( )
inherited

Returns the current item of the internal selection model.

Returns
ProjectItem* The current item.

Definition at line 139 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemFromIndex(), Isis::ProjectItemModel::selectedItems(), and Isis::ProjectItemModel::selectionModel().

Referenced by Isis::AbstractProjectItemView::currentItem().

◆ dropMimeData()

bool Isis::ProjectItemProxyModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
virtual

Adds the data (selected items) from the source model to the proxy model.

Parameters
data(const QMimeData *)
action(Qt::DropAction)
row(int)
column(int)
QModelIndex(const QModelIndex &)
Returns
bool True if the data was successfully added to the proxy model.

Definition at line 437 of file ProjectItemProxyModel.cpp.

References addItems(), Isis::ProjectItemModel::selectedItems(), and sourceModel().

◆ findItemData()

ProjectItem * Isis::ProjectItemModel::findItemData ( const QVariant &  data,
int  role = Qt::UserRole+1 
)
inherited

Returns the first item found that contains the given data in the given role or a null pointer if no item is found.

Parameters
data(const QVariant &) The data contained in the item.
role(int) The role of the data (see Qt::ItemDataRole).
Returns
ProjectItem* First project item found.

Definition at line 290 of file ProjectItemModel.cpp.

References Isis::ProjectItem::findItemData(), and Isis::ProjectItemModel::item().

Referenced by Isis::ControlHealthMonitorView::openImageEditor(), Isis::ProjectItemModel::selectedBOSSImages(), Isis::Project::setActiveControl(), Isis::Project::setActiveImageList(), Isis::ImportImagesWorkOrder::undoExecution(), Isis::ImportMapTemplateWorkOrder::undoExecution(), Isis::ImportRegistrationTemplateWorkOrder::undoExecution(), and Isis::ImportShapesWorkOrder::undoExecution().

◆ flags()

Qt::ItemFlags Isis::ProjectItemModel::flags ( const QModelIndex &  index) const
inherited

This virtual method was added to handle changing the project name by double-clicking the project name on the project tree.

It was required by Qt in order to allow editing capabilities.

See also
http://doc.qt.io/qt-5/modelview.html
Parameters
index(const QModelIndex &) Field which has been edited
Returns
Qt::ItemFlags Add the ItemIsEditable to the standard flags.

Definition at line 914 of file ProjectItemModel.cpp.

◆ indexFromItem()

QModelIndex Isis::ProjectItemModel::indexFromItem ( const ProjectItem item)
inherited

Returns the QModelIndex corresponding to a given ProjectItem.

Parameters
item(const ProjectItem *) The item.
Returns
QModelIndex The index of the item.

Definition at line 366 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item().

◆ insertRow()

void Isis::ProjectItemModel::insertRow ( int  row,
ProjectItem item 
)
inherited

Inserts a top-level item at the given row.

Parameters
row(int) The row where the item will be inserted.
item(ProjectItem *) The item to insert.

Definition at line 377 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item().

◆ item()

◆ itemAdded

void Isis::ProjectItemModel::itemAdded ( ProjectItem )
signalinherited

This signal is emitted when a ProjectItem is added to the model.

Referenced by Isis::ProjectItemModel::onRowsInserted().

◆ itemFromIndex()

◆ mapIndexFromSource()

QModelIndex Isis::ProjectItemProxyModel::mapIndexFromSource ( const QModelIndex &  sourceIndex)

Returns the QModelIndex of an item in the proxy model that corresponds with the QModelIndex of an item in the source model.

Parameters
[in]sourceIndex(const QModelIndex &) The index from the source model.
Returns
QModelIndex The index from the proxy model.

Definition at line 45 of file ProjectItemProxyModel.cpp.

References Isis::ProjectItemModel::itemFromIndex(), mapItemFromSource(), and sourceModel().

Referenced by mapSelectionFromSource(), and updateProxyCurrent().

◆ mapIndexToSource()

QModelIndex Isis::ProjectItemProxyModel::mapIndexToSource ( const QModelIndex &  proxyIndex)

Returns the QModelIndex of an item in the souce model that corresponds with the QModelIndex of an item in the proxy model.

Parameters
[in]proxyIndex(const QModelIndex &) The index from the proxy model.
Returns
QModelIndex The index from the source model.

Definition at line 66 of file ProjectItemProxyModel.cpp.

References Isis::ProjectItemModel::itemFromIndex(), and mapItemToSource().

Referenced by mapSelectionToSource(), and updateSourceCurrent().

◆ mapItemFromSource()

ProjectItem * Isis::ProjectItemProxyModel::mapItemFromSource ( ProjectItem sourceItem)

Returns the ProjectItem in the proxy model that corresponds with a ProjectItem in the source model.

Parameters
[in]sourceItem(ProjectItem *) The item in the source model.
Returns
ProjectItem* The item in the proxy model.

Definition at line 134 of file ProjectItemProxyModel.cpp.

Referenced by addChild(), addItem(), mapIndexFromSource(), and updateItem().

◆ mapItemToSource()

ProjectItem * Isis::ProjectItemProxyModel::mapItemToSource ( ProjectItem proxyItem)

Returns the ProjectItem in the source model that corresponds with a ProjectItem in the source model.

Parameters
[in]proxyItem(ProjectItem *) The item in the proxy model.
Returns
ProjectItem* The item in the source model.

Definition at line 147 of file ProjectItemProxyModel.cpp.

Referenced by mapIndexToSource(), and removeItem().

◆ mapSelectionFromSource()

QItemSelection Isis::ProjectItemProxyModel::mapSelectionFromSource ( const QItemSelection &  sourceSelection)

Returns a QItemSelection of items in the proxy model that corresponds with a QItemSelection of items in the source model.

Parameters
[in]sourceSelection(const QItemSelection &) The selection of items in the source model.
Returns
QItemSelection The selection of items in the proxy model.

Definition at line 87 of file ProjectItemProxyModel.cpp.

References mapIndexFromSource().

Referenced by updateProxySelection(), and updateSourceSelection().

◆ mapSelectionToSource()

QItemSelection Isis::ProjectItemProxyModel::mapSelectionToSource ( const QItemSelection &  proxySelection)

Returns a QItemSelection of items in the source model that corresponds with a QItemSelection of itesm in the proxy model.

Parameters
[in]proxySelection(const QItemSelection &) The selection of items in the proxy model.
Returns
QItemSelection The selection of items in the source model.

Definition at line 112 of file ProjectItemProxyModel.cpp.

References mapIndexToSource().

Referenced by updateSourceSelection().

◆ onBundleSolutionInfoAdded

void Isis::ProjectItemModel::onBundleSolutionInfoAdded ( BundleSolutionInfo bundleSolutionInfo)
privateslotinherited

Slot to connect to the bundleSolutionInfoAdded() signal from a project.

Adds a ProjectItem that corresponds to the BundleSolutionInfo to the model. The item is added to the item named "Results" of the item that corresponds to the Project that sent the signal.

Parameters
bundleSolutionInfo(BundleSolutionInfo *) The BundleSolutionInfo added to the Project.

Definition at line 468 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::BundleSolutionInfo::name(), Isis::ProjectItem::project(), Isis::BundleSolutionInfo::savedBundleOutputFilename(), Isis::BundleSolutionInfo::savedImagesFilename(), Isis::BundleSolutionInfo::savedPointsFilename(), and Isis::BundleSolutionInfo::savedResidualsFilename().

Referenced by Isis::ProjectItemModel::addProject().

◆ onControlAdded

void Isis::ProjectItemModel::onControlAdded ( Control control)
privateslotinherited

Slot to connect to the controlAdded() signal from a project.

Adds a ProjectItem that corresponds to the Control to the model. The item is added to the item that corresponds to the control's ControlList.

Parameters
control(Control *) The Control added to the Project.

Definition at line 563 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItem::controlList(), Isis::Control::id(), Isis::ProjectItemModel::item(), and Isis::ProjectItem::project().

Referenced by Isis::ProjectItemModel::addProject().

◆ onControlListAdded

void Isis::ProjectItemModel::onControlListAdded ( ControlList controlList)
privateslotinherited

Slot to connect to the controlListAdded() signal from a Project.

Adds a ProjectItem that corresponds to the ControlList to the model. The item is added to the item named "Control Networks" of the item that corresponds to the Project that sent the signal.

Parameters
controlList(ControlList *) The ControlList added to the Project.

Definition at line 602 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::ControlList::name(), and Isis::ProjectItem::project().

Referenced by Isis::ProjectItemModel::addProject().

◆ onGuiCamerasAdded

void Isis::ProjectItemModel::onGuiCamerasAdded ( GuiCameraList cameras)
privateslotinherited

Slot to connect to the guiCamerasAdded() signal from a Project.

Adds items that correspond to the cameras to the model. The items are added to the item named "Sensors" of the item that corresponds to the Project that sent the signal.

Parameters
cameras(GuiCameraList *) The GuiCameraList of the Project.

Definition at line 732 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItem::guiCamera(), Isis::ProjectItemModel::item(), Isis::GuiCameraList::name(), and Isis::ProjectItem::project().

Referenced by Isis::ProjectItemModel::addProject().

◆ onImagesAdded

void Isis::ProjectItemModel::onImagesAdded ( ImageList imageList)
privateslotinherited

Slot to connect to the imagesAdded() signal from a Project.

Adds a ProjectItem that corresponds to the ImageList to the model. The item is added to the item named "Images" of the item that corresponds to the Project that sent the signal.

Parameters
imageList(ImageList *) The ImageList added to the Project.

Definition at line 632 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::ImageList::name(), and Isis::ProjectItem::project().

Referenced by Isis::ProjectItemModel::addProject().

◆ onItemChanged

void Isis::ProjectItemProxyModel::onItemChanged ( QStandardItem item)
privateslot

Signal to connect to the itemChanged() signal from a ProjectItemModel.

Updates the corresponding item in the proxy model.

Parameters
[in]item(QStandardItem *) The item that has been changed.

Definition at line 402 of file ProjectItemProxyModel.cpp.

References Isis::ProjectItemModel::item(), and updateItem().

Referenced by setSourceModel().

◆ onNameChanged

void Isis::ProjectItemModel::onNameChanged ( QString  newName)
privateslotinherited

Slot to connect to the nameChanged() signal from a Project.

Sets the name of the ProjectItem that corresponds with the Project.

Parameters
newName(QString) The new name of the project

Definition at line 441 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item(), Isis::ProjectItem::project(), and Isis::Project::setClean().

Referenced by Isis::ProjectItemModel::addProject().

◆ onRowsInserted

void Isis::ProjectItemModel::onRowsInserted ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslotinherited

Slot to connect to the rowsInserted() signal from QAbstractItemModel.

Emits a corresponding itemAdded() signal for each row inserted.

Parameters
parent(const QModelIndex &) The parent index where rows were inserted.
start(int) The first row inserted (inclusive).
end(int) The last row inserted (inclusive).

Definition at line 812 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemAdded(), and Isis::ProjectItemModel::itemFromIndex().

Referenced by Isis::ProjectItemModel::ProjectItemModel().

◆ onRowsRemoved

void Isis::ProjectItemModel::onRowsRemoved ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslotinherited

Slot to connect to the rowsAboutToBeRemoved() signal from QAbstractItemModel.

Emits a corresponding itemRemoved() signal for each row inserted.

Parameters
parent(const QModelIndex &) The parent index where rows are to be removed.
start(int) The first row to be removed (inclusive).
end(int) The last row to be removed (inclusive).

Definition at line 830 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemFromIndex(), and Isis::ProjectItemModel::itemRemoved().

Referenced by Isis::ProjectItemModel::ProjectItemModel().

◆ onSelectionChanged

void Isis::ProjectItemModel::onSelectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
protectedslotinherited

Slot to connect to the selectionChanged() signal from a selection model.

Updates other factors in the model that rely on selected items but do not directly correspond with the selection model. Currently changes the selected property of Images that correspond with selected or deselected items.

Parameters
selected(const QItemSelection &) The selected items.
deselected(const QItemSelection &) The deselected items.

Definition at line 775 of file ProjectItemModel.cpp.

References Isis::Image::displayProperties(), Isis::ProjectItem::image(), Isis::ProjectItem::isImage(), Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemFromIndex(), Isis::ProjectItemModel::selectedItems(), and Isis::ImageDisplayProperties::setSelected().

Referenced by Isis::ProjectItemModel::ProjectItemModel().

◆ onShapesAdded

void Isis::ProjectItemModel::onShapesAdded ( ShapeList shapes)
privateslotinherited

Slot to connect to the shapesAdded() signal from a Project.

Adds a ProjectItem that corresponds to the ShapeList to the model. The item is added to the item named "Shape Models" of the item that corresponds to the Project that sent the signal.

Parameters
shapes(ShapeList *) The ShapeList added to the Project.

Definition at line 662 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::ShapeList::name(), and Isis::ProjectItem::project().

Referenced by Isis::ProjectItemModel::addProject().

◆ onTargetsAdded

void Isis::ProjectItemModel::onTargetsAdded ( TargetBodyList targets)
privateslotinherited

Slot to connect to the targetsAdded() signal from a Project.

Adds items that correspond to the target bodies to the model. The items are added to the item named "Target Body" of the item that corresponds to the Project that sent the signal.

Parameters
targets(TargetBodyList *) The TargetBodyList of the Project.

Definition at line 691 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::TargetBodyList::name(), Isis::ProjectItem::project(), and Isis::ProjectItem::targetBody().

Referenced by Isis::ProjectItemModel::addProject().

◆ onTemplatesAdded

void Isis::ProjectItemModel::onTemplatesAdded ( TemplateList templateList)
privateslotinherited

Slot connected to the templatesAdded() signal from a project.

Adds a ProjectItem for each newly added template FileName to the model. The Item is added to the corresponding ProjectItem under "Templates" (currently only "Maps" and "Registrations" ) and the name of the TemplateList (import1, import2, etc...).

Parameters
templateListTemplateList of Templates being added to the project.

Definition at line 525 of file ProjectItemModel.cpp.

References Isis::ProjectItem::appendRow(), Isis::ProjectItem::child(), Isis::ProjectItemModel::item(), Isis::ProjectItem::project(), and Isis::TemplateList::type().

Referenced by Isis::ProjectItemModel::addProject().

◆ projectNameEdited

void Isis::ProjectItemModel::projectNameEdited ( QString  )
signalinherited

This signal is emitted when the project name is edited.

Referenced by Isis::ProjectItemModel::setData().

◆ rejectName()

bool Isis::ProjectItemModel::rejectName ( QStringList reserved,
QString  target 
)
privateinherited

Checks to see if we are adding a reserved name to the project (ex.

If we are adding an ImageList, and giving it the same name as another ImageList, or ShapesList, or something else).

Parameters
reservedThe list of reserved names we cannot use.
targetThe name we are querying to see if it is in the reserved list.
Returns
True if target is in the reserved list, False other.

Definition at line 929 of file ProjectItemModel.cpp.

Referenced by Isis::ProjectItemModel::setData().

◆ removeItem()

void Isis::ProjectItemProxyModel::removeItem ( ProjectItem item)
virtual

Removes an item and its children from the proxy model.

Parameters
[in]proxyItem(ProjectItem *) The item to be removed.

Reimplemented from Isis::ProjectItemModel.

Definition at line 208 of file ProjectItemProxyModel.cpp.

References Isis::ProjectItemModel::item(), mapItemToSource(), and Isis::ProjectItemModel::removeItem().

◆ removeItems()

void Isis::ProjectItemModel::removeItems ( QList< ProjectItem * >  items)
virtualinherited

Removes a list of items and their children from the model.

Parameters
items(ProjectItem *) The items to be removed.

Definition at line 342 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item(), and Isis::ProjectItemModel::removeItem().

Referenced by Isis::RemoveImagesWorkOrder::execute().

◆ selectedBOSSImages()

QList< ProjectItem * > Isis::ProjectItemModel::selectedBOSSImages ( )
inherited

ProjectItemModel::selectedBOSSImages.

Returns
This is a refinement of the selectedItems function which was needed to display a subset of Images/ImageLists in the Bundle Observation Solve Settings (BOSS) tab of the JigsawSetupDialog widget. The primary consumer of the selected images is going to be the SortFilterProxyModel class.

Definition at line 177 of file ProjectItemModel.cpp.

References Isis::ProjectItem::child(), Isis::ProjectItemModel::findItemData(), Isis::ProjectItem::isImage(), Isis::ProjectItem::isImageList(), Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemFromIndex(), Isis::ProjectItem::parent(), and Isis::ProjectItemModel::selectionModel().

◆ selectedItems()

◆ selectionModel()

◆ setData()

bool Isis::ProjectItemModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
inherited

This virtual method was added to handle changing the project name by double-clicking the project name on the project tree.

It was required by Qt in order to allow editing capabilities.

See also
http://doc.qt.io/qt-5/modelview.html
Parameters
index(const QModelIndex &) Field which has been edited
value(const QVariant &) Value contained in the field
role(int) Will always be EditRole since field only contains text
Returns
bool Returns true if successful; otherwise false

Definition at line 854 of file ProjectItemModel.cpp.

References Isis::ProjectItem::bundleSolutionInfo(), Isis::ProjectItemModel::cleanProject(), Isis::ProjectItem::controlList(), Isis::ProjectItem::imageList(), Isis::ProjectItem::isBundleSolutionInfo(), Isis::ProjectItem::isControlList(), Isis::ProjectItem::isImageList(), Isis::ProjectItem::isProject(), Isis::ProjectItem::isShapeList(), Isis::ProjectItemModel::item(), Isis::ProjectItemModel::itemFromIndex(), Isis::ProjectItemModel::projectNameEdited(), Isis::ProjectItemModel::rejectName(), Isis::BundleSolutionInfo::setName(), Isis::ControlList::setName(), Isis::ImageList::setName(), Isis::ShapeList::setName(), and Isis::ProjectItem::shapeList().

◆ setItem()

void Isis::ProjectItemModel::setItem ( int  row,
ProjectItem item 
)
inherited

Sets the item at the top-level row.

Parameters
row(int) The row where the item will be set.
item(ProjectItem *) The item to set the row to.

Definition at line 412 of file ProjectItemModel.cpp.

References Isis::ProjectItemModel::item().

Referenced by Isis::BundleObservationView::displayCsvFile().

◆ setSourceModel()

void Isis::ProjectItemProxyModel::setSourceModel ( ProjectItemModel sourceModel)

Sets the source model.

If there are already items in the model and the source model is set to a different source model, the proxy model is cleared first.

Parameters
[in]sourceModel(ProjectItemModel *) The source model.

Definition at line 224 of file ProjectItemProxyModel.cpp.

References m_sourceModel, onItemChanged(), Isis::ProjectItemModel::selectionModel(), sourceModel(), updateProxyCurrent(), updateProxySelection(), updateSourceCurrent(), and updateSourceSelection().

Referenced by addChild().

◆ sourceModel()

ProjectItemModel * Isis::ProjectItemProxyModel::sourceModel ( )

Returns the source model.

Returns
ProjectItemModel* The source model.

Definition at line 266 of file ProjectItemProxyModel.cpp.

References m_sourceModel.

Referenced by addChild(), dropMimeData(), mapIndexFromSource(), setSourceModel(), updateProxyCurrent(), updateProxySelection(), updateSourceCurrent(), and updateSourceSelection().

◆ takeItem()

ProjectItem * Isis::ProjectItemModel::takeItem ( int  row)
inherited

Removes the top-level row and returns the removed item.

Parameters
row(int) The row of the item to remove.
Returns
ProjectItem* The removed item.

Definition at line 424 of file ProjectItemModel.cpp.

◆ updateItem

void Isis::ProjectItemProxyModel::updateItem ( ProjectItem sourceItem)
protectedslot

Given an item in the source model, this method changes the data of the corresponding item in the proxy model to match that of the item in the source model.

Parameters
[in]sourceItem(ProjectItem *) The item in the source model.

Definition at line 278 of file ProjectItemProxyModel.cpp.

References mapItemFromSource().

Referenced by onItemChanged().

◆ updateProxyCurrent

void Isis::ProjectItemProxyModel::updateProxyCurrent ( )
protectedslot

Slot that updates the current item in the proxy model only if it is different than the corresponding item in the source model.

Definition at line 289 of file ProjectItemProxyModel.cpp.

References mapIndexFromSource(), Isis::ProjectItemModel::selectionModel(), and sourceModel().

Referenced by setSourceModel().

◆ updateProxySelection

void Isis::ProjectItemProxyModel::updateProxySelection ( )
protectedslot

Slot that updates the selection in the proxy model only if it is different than the corresponding selection in the source model.

Definition at line 315 of file ProjectItemProxyModel.cpp.

References mapSelectionFromSource(), Isis::ProjectItemModel::selectionModel(), and sourceModel().

Referenced by setSourceModel().

◆ updateSourceCurrent

void Isis::ProjectItemProxyModel::updateSourceCurrent ( )
protectedslot

Slot that updates the current item in the proxy model only if it is different than the corresponding item in the source model.

Definition at line 302 of file ProjectItemProxyModel.cpp.

References mapIndexToSource(), Isis::ProjectItemModel::selectionModel(), and sourceModel().

Referenced by setSourceModel().

◆ updateSourceSelection

void Isis::ProjectItemProxyModel::updateSourceSelection ( )
protectedslot

Slot that updates the selection in the source model only if it is different than the corresponding selection in the proxy model.

Definition at line 328 of file ProjectItemProxyModel.cpp.

References mapSelectionFromSource(), mapSelectionToSource(), Isis::ProjectItemModel::selectionModel(), and sourceModel().

Referenced by setSourceModel().

Member Data Documentation

◆ m_selectionModel

QItemSelectionModel* Isis::ProjectItemModel::m_selectionModel
privateinherited

The internal selection model.

Definition at line 212 of file ProjectItemModel.h.

Referenced by Isis::ProjectItemModel::ProjectItemModel(), and Isis::ProjectItemModel::selectionModel().

◆ m_sourceModel

ProjectItemModel* Isis::ProjectItemProxyModel::m_sourceModel
private

The source model. Map of items from the source model to the proxy model.

Definition at line 123 of file ProjectItemProxyModel.h.

Referenced by ProjectItemProxyModel(), setSourceModel(), and sourceModel().


The documentation for this class was generated from the following files:
Isis::ProjectItemModel::ProjectItemModel
ProjectItemModel(QObject *parent=0)
Constructs an empty model.
Definition: ProjectItemModel.cpp:44
Isis::ProjectItemProxyModel::ProjectItemProxyModel
ProjectItemProxyModel(QObject *parent=0)
Constructs the proxy model.
Definition: ProjectItemProxyModel.cpp:30