Isis 3 Programmer Reference
ProjectItemModel.h
1 #ifndef ProjectItemModel_h
2 #define ProjectItemModel_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QStandardItemModel>
13 
14 #include "FileName.h"
15 
16 class QItemSelection;
17 class QItemSelectionModel;
18 class QMimeData;
19 class QModelIndex;
20 class QString;
21 class QStringList;
22 class QVariant;
23 
24 namespace Isis {
25 
26  class ShapeList;
27  class BundleSolutionInfo;
28  class Control;
29  class ControlList;
30  class FileName;
31  class GuiCameraList;
32  class ImageList;
33  class Project;
34  class ProjectItem;
35  class TargetBodyList;
36  class TemplateList;
37 
133 
134  Q_OBJECT
135 
136  public:
137  ProjectItemModel(QObject *parent = 0);
139 
140  QItemSelectionModel *selectionModel();
141 
142  ProjectItem *addProject(Project *project);
143 
144  ProjectItem *findItemData(const QVariant &data, int role = Qt::UserRole+1);
145 
146  virtual bool canDropMimeData(const QMimeData *data,
147  Qt::DropAction action,
148  int row, int column,
149  const QModelIndex& parent) const;
150 
151  virtual void removeItem(ProjectItem *item);
152  virtual void removeItems(QList<ProjectItem *> items);
153 
157 
158 
159  void appendRow(ProjectItem *item);
160  void clean();
161  QModelIndex indexFromItem(const ProjectItem *item);
162  void insertRow(int row, ProjectItem *item);
163  ProjectItem *item(int row);
164  ProjectItem *itemFromIndex(const QModelIndex &index);
165  void setItem(int row, ProjectItem *item);
166  ProjectItem *takeItem(int row);
167 
168  bool setData(const QModelIndex &index, const QVariant &value, int role);
169  Qt::ItemFlags flags(const QModelIndex &index) const;
170 
171  signals:
176 
177 
182 
186  void cleanProject(bool);
187 
188 
192  void projectNameEdited(QString);
193 
194  protected slots:
195  void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
196 
197  private slots:
198  void onNameChanged(QString newName);
199  void onBundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo);
200  void onImagesAdded(ImageList *images);
201  void onShapesAdded(ShapeList *shapes);
202  void onControlAdded(Control *control);
203  void onControlListAdded(ControlList *controlList);
204  void onTargetsAdded(TargetBodyList *targets);
205  void onTemplatesAdded(TemplateList *templateList);
206  void onGuiCamerasAdded(GuiCameraList *cameras);
207  void onRowsInserted(const QModelIndex &parent, int start, int end);
208  void onRowsRemoved(const QModelIndex &parent, int start, int end);
209 
210  private:
211 
212  QItemSelectionModel *m_selectionModel;
213  QStringList m_reservedNames;
214  bool rejectName(QStringList &reserved, QString target);
215 
216 
217  };
218 
219 }
220 
221 #endif
Isis::ProjectItemModel
Provides access to data stored in a Project through Qt's model-view framework.
Definition: ProjectItemModel.h:132
Isis::ProjectItemModel::setItem
void setItem(int row, ProjectItem *item)
Sets the item at the top-level row.
Definition: ProjectItemModel.cpp:412
Isis::ProjectItemModel::onRowsInserted
void onRowsInserted(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsInserted() signal from QAbstractItemModel.
Definition: ProjectItemModel.cpp:812
Isis::ProjectItemModel::onControlListAdded
void onControlListAdded(ControlList *controlList)
Slot to connect to the controlListAdded() signal from a Project.
Definition: ProjectItemModel.cpp:602
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::ProjectItemModel::onSelectionChanged
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Slot to connect to the selectionChanged() signal from a selection model.
Definition: ProjectItemModel.cpp:775
Isis::ProjectItemModel::projectNameEdited
void projectNameEdited(QString)
This signal is emitted when the project name is edited.
Isis::ProjectItemModel::appendRow
void appendRow(ProjectItem *item)
Appends a top-level item to the model.
Definition: ProjectItemModel.cpp:354
Isis::ProjectItemModel::onGuiCamerasAdded
void onGuiCamerasAdded(GuiCameraList *cameras)
Slot to connect to the guiCamerasAdded() signal from a Project.
Definition: ProjectItemModel.cpp:732
Isis::ProjectItemModel::selectedBOSSImages
QList< ProjectItem * > selectedBOSSImages()
ProjectItemModel::selectedBOSSImages.
Definition: ProjectItemModel.cpp:177
Isis::ControlList
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
Definition: ControlList.h:44
Isis::ProjectItemModel::removeItems
virtual void removeItems(QList< ProjectItem * > items)
Removes a list of items and their children from the model.
Definition: ProjectItemModel.cpp:342
Isis::ProjectItemModel::selectionModel
QItemSelectionModel * selectionModel()
Returns the internal selection model.
Definition: ProjectItemModel.cpp:93
Isis::ProjectItemModel::ProjectItemModel
ProjectItemModel(QObject *parent=0)
Constructs an empty model.
Definition: ProjectItemModel.cpp:44
Isis::TemplateList
Definition: TemplateList.h:35
Isis::ProjectItemModel::clean
void clean()
Used to clean the ProjectItemModel of everything but the headers.
Definition: ProjectItemModel.cpp:952
Isis::Control
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:66
Isis::ProjectItemModel::item
ProjectItem * item(int row)
Returns the top-level item at the given row.
Definition: ProjectItemModel.cpp:389
Isis::ProjectItemModel::itemFromIndex
ProjectItem * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
Definition: ProjectItemModel.cpp:401
QStringList
Isis::ProjectItemModel::itemAdded
void itemAdded(ProjectItem *)
This signal is emitted when a ProjectItem is added to the model.
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::ProjectItemModel::onControlAdded
void onControlAdded(Control *control)
Slot to connect to the controlAdded() signal from a project.
Definition: ProjectItemModel.cpp:563
Isis::ProjectItemModel::~ProjectItemModel
~ProjectItemModel()
Destructs the model.
Definition: ProjectItemModel.cpp:62
Isis::ImageList
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
Isis::ProjectItemModel::onTemplatesAdded
void onTemplatesAdded(TemplateList *templateList)
Slot connected to the templatesAdded() signal from a project.
Definition: ProjectItemModel.cpp:525
Isis::ProjectItemModel::onImagesAdded
void onImagesAdded(ImageList *images)
Slot to connect to the imagesAdded() signal from a Project.
Definition: ProjectItemModel.cpp:632
Isis::ProjectItemModel::selectedItems
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
Definition: ProjectItemModel.cpp:158
Isis::ProjectItemModel::m_selectionModel
QItemSelectionModel * m_selectionModel
The internal selection model.
Definition: ProjectItemModel.h:212
Isis::ProjectItemModel::cleanProject
void cleanProject(bool)
This signal is emitted whrn a ProjectItem's name is changed.
Isis::BundleSolutionInfo
Container class for BundleAdjustment results.
Definition: BundleSolutionInfo.h:159
Isis::ProjectItemModel::onShapesAdded
void onShapesAdded(ShapeList *shapes)
Slot to connect to the shapesAdded() signal from a Project.
Definition: ProjectItemModel.cpp:662
Isis::ProjectItemModel::addProject
ProjectItem * addProject(Project *project)
Adds a Project to the model.
Definition: ProjectItemModel.cpp:107
QStandardItemModel
Isis::ShapeList
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
Isis::TargetBodyList
List for holding TargetBodies.
Definition: TargetBodyList.h:33
Isis::ProjectItemModel::findItemData
ProjectItem * 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 i...
Definition: ProjectItemModel.cpp:290
Isis::ProjectItemModel::canDropMimeData
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.
Definition: ProjectItemModel.cpp:80
Isis::ProjectItemModel::onBundleSolutionInfoAdded
void onBundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo)
Slot to connect to the bundleSolutionInfoAdded() signal from a project.
Definition: ProjectItemModel.cpp:468
Isis::ProjectItemModel::rejectName
bool rejectName(QStringList &reserved, QString target)
Checks to see if we are adding a reserved name to the project (ex.
Definition: ProjectItemModel.cpp:929
Isis::ProjectItemModel::itemRemoved
void itemRemoved(ProjectItem *)
This signal is emitted when a ProjectItem is removed to the model.
Isis::ProjectItemModel::insertRow
void insertRow(int row, ProjectItem *item)
Inserts a top-level item at the given row.
Definition: ProjectItemModel.cpp:377
Isis::ProjectItemModel::indexFromItem
QModelIndex indexFromItem(const ProjectItem *item)
Returns the QModelIndex corresponding to a given ProjectItem.
Definition: ProjectItemModel.cpp:366
Isis::ProjectItemModel::takeItem
ProjectItem * takeItem(int row)
Removes the top-level row and returns the removed item.
Definition: ProjectItemModel.cpp:424
QObject
Isis::ProjectItemModel::onNameChanged
void onNameChanged(QString newName)
Slot to connect to the nameChanged() signal from a Project.
Definition: ProjectItemModel.cpp:441
Isis::ProjectItemModel::currentItem
ProjectItem * currentItem()
Returns the current item of the internal selection model.
Definition: ProjectItemModel.cpp:139
Isis::GuiCameraList
List of GuiCameras saved as QSharedPointers.
Definition: GuiCameraList.h:35
Isis::ProjectItemModel::removeItem
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
Definition: ProjectItemModel.cpp:315
Isis::ProjectItemModel::setData
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...
Definition: ProjectItemModel.cpp:854
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ProjectItemModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
This virtual method was added to handle changing the project name by double-clicking the project name...
Definition: ProjectItemModel.cpp:914
Isis::ProjectItemModel::onRowsRemoved
void onRowsRemoved(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsAboutToBeRemoved() signal from QAbstractItemModel.
Definition: ProjectItemModel.cpp:830
Isis::ProjectItemModel::onTargetsAdded
void onTargetsAdded(TargetBodyList *targets)
Slot to connect to the targetsAdded() signal from a Project.
Definition: ProjectItemModel.cpp:691
Isis::ProjectItem
Represents an item of a ProjectItemModel in Qt's model-view framework.
Definition: ProjectItem.h:134