Isis 3 Programmer Reference
Isis::ProjectItemModel Class Reference

Provides access to data stored in a Project through Qt's model-view framework. More...

#include <ProjectItemModel.h>

Inheritance diagram for Isis::ProjectItemModel:
Inheritance graph
Collaboration diagram for Isis::ProjectItemModel:
Collaboration graph

Signals

void itemAdded (ProjectItem *)
 This signal is emitted when a ProjectItem is added to the model. More...
 
void itemRemoved (ProjectItem *)
 This signal is emitted when a ProjectItem is removed 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

 ProjectItemModel (QObject *parent=0)
 Constructs an empty model. More...
 
 ~ProjectItemModel ()
 Destructs the 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 bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
 You cannot drop mime data into the ProjectItemModel. More...
 
virtual void removeItem (ProjectItem *item)
 Removes an item and its children from the model. 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 onSelectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 Slot to connect to the selectionChanged() signal from a selection model. More...
 

Private Slots

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

QItemSelectionModel * m_selectionModel
 The internal selection model. More...
 
QStringList m_reservedNames
 

Detailed Description

Provides access to data stored in a Project through Qt's model-view framework.

Items corresponding to data are organized in a tree structure. Data can be accessed through a ProjectItem or through a QModelIndex. Views associated with the model can access it either through the model directly or through a ProjectItemProxyModel.

Top-level items can be accessed through the item() method using the row where the item is stored. Children of items can be accessed through the child() method on the parent item. The data stored in an item can be accessed as a QVariant using the data() method of the item or through the various convenience methods in ProjectItem. Alternatively, the data in an item can be accessed with its corresponding QModelIndex and the model's data() method. It should be noted that the data() method in the model and the data() method of ProjectItem require a Qt::ItemDataRole interpreted as an int. Data stored in the model that correspond to Isis classes are stored as Qt::UserRole + 1.

Top-level items should be added to the model using the appendRow() or the insertRow() method. To add child items to a parent item the appendRow() or insertRow() methods of the parent item should be used.

The model keeps track of selected items and the current item using an internal QItemSelectionModel.

Views that only need access to a subset of the items or the items organized in a different way should use a ProjectItemProxyModel.

Image *image = new Image("example.cub");
ProjectItem *item = new ProjectItem(image);
model->appendRow(item);
Author
2015-10-21 Jeffrey Covington
History:
2015-10-21 Jeffrey Covington - Original version.
History:
2016-01-13 Jeffrey Covington - Added canDropMimeData() method.
History:
2016-06-27 Ian Humphrey - Added documentation to canDropMimeData(), checked coding standards. Fixes #4006.
History:
2016-07-18 Tracie Sucharski - Added Project Item slots for adding shape models.
History:
2016-08-25 Adam Paquette - Updated documentation. Fixes #4299.
History:
2017-04-17 Tracie Sucharski - Made changeds to allow project name to be edited from the ProjectItemTree, by double-clicking on the project name. This functionality required the addition of the setData and flags methods. The projectNameEdited signal is also emitted. Fixes #2295
History:
2017-05-04 J Bonn - Added FileItem to project tree. Fixes #4838.
History:
2017-07-12 Cole Neubauer - Added clean function to clear data from project tree while keeping headers, needed to remove old projects data when opening a new one Fixes #4969
History:
2017-07-13 Makayla Shepherd - Added the ability to change the name of image imports, shape imports, and bundle solution info. Fixes #4855, #4979, #4980.
History:
2017-07-27 Tyler Wilson - Added the ability to validate and restrict what names a user can name things like ImageLists/ShapeLists/ControlLists. (ie. this class maintains a QStringList of reserved words which cannot be used for naming objects). Fixes #5047.
History:
2017-08-08 Marjorie Hahn - Modified removeItem() so that if the item to be removed has any children then they can be removed first. Fixes #5074.
History:
2017-08-11 Cole Neubauer - Added a project setClean(false) call to onNameChanged slot. This will make a name change be treated as a project change Fixes #5113
History:
2017-08-11 Christopher Combs - Added onTemplatesAdded() and connected it to the signal sent by Project. Fixes #5086.
History:
2017-08-14 Summer Stapleton - Updated icons/images to properly licensed or open source images. Fixes #5105.
History:
2017-10-30 Adam Goins - Modified currentItem() to return the first selected item in the project tree if there is no valid currentIndex. This would happen if the user was interacting with a cubeDN or footprint view and then tried right clicking on the project tree. Fixes #5111.
History:
2017-11-13 Makayla Shepherd - Modifying the name of an ImageList, ShapeList or BundeSolutionInfo on the ProjectTree now sets the project to not clean. Fixes #5174.
History:
2017-11-03 Christopher Combs - Added support for new Template and TemplateList classes. Fixes #5117.
History:
2018-03-22 Ken Edmundson - Modified method onBundleSolutionInfoAdded to append the bundleoutput.txt (Summary) file to the BundleSolution Statistics node. Also changed the name of the Images node under Statistics to Image to prevent Import Images to appear on it's context menu.
History:
2018-06-21 Tyler Wilson - Added the function selectedBOSSImages(). This is a refinement of selectedItems and is used by the JigsawSetupDialog Bundle Observation Solve Settings (BOSS) tab when displaying a subset of user-selected images. References #497
History:
2018-06-24 Tyler Wilson - Fixed an edge-case scenario in the selection criteria for selectedBOSSImages(). If a user selected an image list and some (but not all) of the images within that list, the function returned all of the images in the list and not just the selected ones. References #497.
History:
2018-07-10 Kaitlyn Lee - If a user does not select any images in the project tree, all image lists and images will be returned in selectedBOSSImages(). References #497.

Definition at line 132 of file ProjectItemModel.h.

Constructor & Destructor Documentation

◆ ProjectItemModel()

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

Constructs an empty model.

Parameters
parent(QObject *) The parent.

Definition at line 44 of file ProjectItemModel.cpp.

References m_selectionModel, onRowsInserted(), onRowsRemoved(), and onSelectionChanged().

◆ ~ProjectItemModel()

Isis::ProjectItemModel::~ProjectItemModel ( )

Destructs the model.

Definition at line 62 of file ProjectItemModel.cpp.

Member Function Documentation

◆ addProject()

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

Adds a Project to the model.

An item is created that corresponds to the Project as well as children items that correspond to various parts of the Project.

Parameters
project(Project *) The Project to be added.
Returns
ProjectItem* The new item that corresponds to the Project.

Definition at line 107 of file ProjectItemModel.cpp.

References appendRow(), onBundleSolutionInfoAdded(), onControlAdded(), onControlListAdded(), onGuiCamerasAdded(), onImagesAdded(), onNameChanged(), onShapesAdded(), onTargetsAdded(), and onTemplatesAdded().

◆ appendRow()

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

Appends a top-level item to the model.

Parameters
item(ProjectItem *) The item to append.

Definition at line 354 of file ProjectItemModel.cpp.

References item().

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

◆ canDropMimeData()

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

You cannot drop mime data into the ProjectItemModel.

See also
ProjectItemProxyModel
Parameters
data(const QMimeData *) The data to drop
action(Qt::DropAction) The drop action
row(int) ???
column(int) ???
parent(const QModelIndex &) The index of the data's parent
Returns
bool False

Reimplemented in Isis::ProjectItemProxyModel.

Definition at line 80 of file ProjectItemModel.cpp.

◆ clean()

void Isis::ProjectItemModel::clean ( )

Used to clean the ProjectItemModel of everything but the headers.

Definition at line 952 of file ProjectItemModel.cpp.

References Isis::ProjectItem::child(), item(), Isis::ProjectItem::project(), and removeItem().

◆ cleanProject

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

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

Referenced by setData().

◆ currentItem()

ProjectItem * Isis::ProjectItemModel::currentItem ( )

Returns the current item of the internal selection model.

Returns
ProjectItem* The current item.

Definition at line 139 of file ProjectItemModel.cpp.

References item(), itemFromIndex(), selectedItems(), and selectionModel().

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

◆ findItemData()

ProjectItem * Isis::ProjectItemModel::findItemData ( 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.

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 item().

Referenced by Isis::ControlHealthMonitorView::openImageEditor(), 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

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)

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 item().

◆ insertRow()

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

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 item().

◆ item()

◆ itemAdded

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

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

Referenced by onRowsInserted().

◆ itemFromIndex()

ProjectItem * Isis::ProjectItemModel::itemFromIndex ( const QModelIndex &  index)

◆ itemRemoved

void Isis::ProjectItemModel::itemRemoved ( ProjectItem )
signal

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

Referenced by onRowsRemoved().

◆ onBundleSolutionInfoAdded

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

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(), item(), Isis::BundleSolutionInfo::name(), Isis::ProjectItem::project(), Isis::BundleSolutionInfo::savedBundleOutputFilename(), Isis::BundleSolutionInfo::savedImagesFilename(), Isis::BundleSolutionInfo::savedPointsFilename(), and Isis::BundleSolutionInfo::savedResidualsFilename().

Referenced by addProject().

◆ onControlAdded

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

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(), item(), and Isis::ProjectItem::project().

Referenced by addProject().

◆ onControlListAdded

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

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(), item(), Isis::ControlList::name(), and Isis::ProjectItem::project().

Referenced by addProject().

◆ onGuiCamerasAdded

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

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(), item(), Isis::GuiCameraList::name(), and Isis::ProjectItem::project().

Referenced by addProject().

◆ onImagesAdded

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

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(), item(), Isis::ImageList::name(), and Isis::ProjectItem::project().

Referenced by addProject().

◆ onNameChanged

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

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 item(), Isis::ProjectItem::project(), and Isis::Project::setClean().

Referenced by addProject().

◆ onRowsInserted

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

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 item(), itemAdded(), and itemFromIndex().

Referenced by ProjectItemModel().

◆ onRowsRemoved

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

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 item(), itemFromIndex(), and itemRemoved().

Referenced by ProjectItemModel().

◆ onSelectionChanged

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

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(), item(), itemFromIndex(), selectedItems(), and Isis::ImageDisplayProperties::setSelected().

Referenced by ProjectItemModel().

◆ onShapesAdded

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

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(), item(), Isis::ShapeList::name(), and Isis::ProjectItem::project().

Referenced by addProject().

◆ onTargetsAdded

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

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(), item(), Isis::TargetBodyList::name(), Isis::ProjectItem::project(), and Isis::ProjectItem::targetBody().

Referenced by addProject().

◆ onTemplatesAdded

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

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(), item(), Isis::ProjectItem::project(), and Isis::TemplateList::type().

Referenced by addProject().

◆ projectNameEdited

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

This signal is emitted when the project name is edited.

Referenced by setData().

◆ rejectName()

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

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 setData().

◆ removeItem()

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

Removes an item and its children from the model.

Parameters
item(ProjectItem *) The item to be removed.
History:
2017-08-08 Marjorie Hahn - Added a check so that if the item to be removed has any children then they can be removed first. Fixes #5074.

Reimplemented in Isis::ProjectItemProxyModel.

Definition at line 315 of file ProjectItemModel.cpp.

References Isis::ProjectItem::child(), item(), and Isis::ProjectItem::parent().

Referenced by clean(), Isis::RemoveImagesWorkOrder::execute(), Isis::ProjectItemProxyModel::removeItem(), removeItems(), Isis::ImportImagesWorkOrder::undoExecution(), Isis::ImportMapTemplateWorkOrder::undoExecution(), Isis::ImportRegistrationTemplateWorkOrder::undoExecution(), and Isis::ImportShapesWorkOrder::undoExecution().

◆ removeItems()

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

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 item(), and removeItem().

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

◆ selectedBOSSImages()

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

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(), findItemData(), Isis::ProjectItem::isImage(), Isis::ProjectItem::isImageList(), item(), itemFromIndex(), Isis::ProjectItem::parent(), and selectionModel().

◆ selectedItems()

QList< ProjectItem * > Isis::ProjectItemModel::selectedItems ( )

◆ selectionModel()

◆ setData()

bool Isis::ProjectItemModel::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.

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(), cleanProject(), Isis::ProjectItem::controlList(), Isis::ProjectItem::imageList(), Isis::ProjectItem::isBundleSolutionInfo(), Isis::ProjectItem::isControlList(), Isis::ProjectItem::isImageList(), Isis::ProjectItem::isProject(), Isis::ProjectItem::isShapeList(), item(), itemFromIndex(), projectNameEdited(), 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 
)

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 item().

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

◆ takeItem()

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

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.

Member Data Documentation

◆ m_selectionModel

QItemSelectionModel* Isis::ProjectItemModel::m_selectionModel
private

The internal selection model.

Definition at line 212 of file ProjectItemModel.h.

Referenced by ProjectItemModel(), and selectionModel().


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::ProjectItemModel::item
ProjectItem * item(int row)
Returns the top-level item at the given row.
Definition: ProjectItemModel.cpp:389