Isis 3 Programmer Reference
ProjectItemModel.h
Go to the documentation of this file.
1 #ifndef ProjectItemModel_h
2 #define ProjectItemModel_h
3 
26 #include <QStandardItemModel>
27 
28 #include "FileName.h"
29 
30 class QItemSelection;
31 class QItemSelectionModel;
32 class QMimeData;
33 class QModelIndex;
34 class QString;
35 class QStringList;
36 class QVariant;
37 
38 namespace Isis {
39 
40  class ShapeList;
41  class BundleSolutionInfo;
42  class Control;
43  class ControlList;
44  class FileName;
45  class GuiCameraList;
46  class ImageList;
47  class Project;
48  class ProjectItem;
49  class TargetBodyList;
50  class TemplateList;
51 
147 
148  Q_OBJECT
149 
150  public:
151  ProjectItemModel(QObject *parent = 0);
153 
154  QItemSelectionModel *selectionModel();
155 
156  ProjectItem *addProject(Project *project);
157 
158  ProjectItem *findItemData(const QVariant &data, int role = Qt::UserRole+1);
159 
160  virtual bool canDropMimeData(const QMimeData *data,
161  Qt::DropAction action,
162  int row, int column,
163  const QModelIndex& parent) const;
164 
165  virtual void removeItem(ProjectItem *item);
166  virtual void removeItems(QList<ProjectItem *> items);
167 
171 
172 
173  void appendRow(ProjectItem *item);
174  void clean();
175  QModelIndex indexFromItem(const ProjectItem *item);
176  void insertRow(int row, ProjectItem *item);
177  ProjectItem *item(int row);
178  ProjectItem *itemFromIndex(const QModelIndex &index);
179  void setItem(int row, ProjectItem *item);
180  ProjectItem *takeItem(int row);
181 
182  bool setData(const QModelIndex &index, const QVariant &value, int role);
183  Qt::ItemFlags flags(const QModelIndex &index) const;
184 
185  signals:
189  void itemAdded(ProjectItem *);
190 
191 
195  void itemRemoved(ProjectItem *);
196 
200  void cleanProject(bool);
201 
202 
206  void projectNameEdited(QString);
207 
208  protected slots:
209  void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
210 
211  private slots:
212  void onNameChanged(QString newName);
213  void onBundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo);
214  void onImagesAdded(ImageList *images);
215  void onShapesAdded(ShapeList *shapes);
216  void onControlAdded(Control *control);
217  void onControlListAdded(ControlList *controlList);
218  void onTargetsAdded(TargetBodyList *targets);
219  void onTemplatesAdded(TemplateList *templateList);
220  void onGuiCamerasAdded(GuiCameraList *cameras);
221  void onRowsInserted(const QModelIndex &parent, int start, int end);
222  void onRowsRemoved(const QModelIndex &parent, int start, int end);
223 
224  private:
225 
226  QItemSelectionModel *m_selectionModel;
227  QStringList m_reservedNames;
228  bool rejectName(QStringList &reserved, QString target);
229 
230 
231  };
232 
233 }
234 
235 #endif
QModelIndex indexFromItem(const ProjectItem *item)
Returns the QModelIndex corresponding to a given ProjectItem.
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:79
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
void insertRow(int row, ProjectItem *item)
Inserts a top-level item at the given row.
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.
void itemAdded(ProjectItem *)
This signal is emitted when a ProjectItem is added to the model.
ProjectItem * takeItem(int row)
Removes the top-level row and returns the removed item.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
void onControlAdded(Control *control)
Slot to connect to the controlAdded() signal from a project.
bool rejectName(QStringList &reserved, QString target)
Checks to see if we are adding a reserved name to the project (ex.
The main project for ipce.
Definition: Project.h:289
ProjectItem * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
Container class for BundleAdjustment results.
void cleanProject(bool)
This signal is emitted whrn a ProjectItem&#39;s name is changed.
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:36
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...
ProjectItem * currentItem()
Returns the current item of the internal selection model.
void onImagesAdded(ImageList *images)
Slot to connect to the imagesAdded() signal from a Project.
List for holding TargetBodies.
void onControlListAdded(ControlList *controlList)
Slot to connect to the controlListAdded() signal from a Project.
void onBundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo)
Slot to connect to the bundleSolutionInfoAdded() signal from a project.
void onRowsRemoved(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsAboutToBeRemoved() signal from QAbstractItemModel.
void onTargetsAdded(TargetBodyList *targets)
Slot to connect to the targetsAdded() signal from a Project.
Provides access to data stored in a Project through Qt&#39;s model-view framework.
void projectNameEdited(QString)
This signal is emitted when the project name is edited.
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...
void itemRemoved(ProjectItem *)
This signal is emitted when a ProjectItem is removed to the model.
virtual void removeItems(QList< ProjectItem *> items)
Removes a list of items and their children from the model.
void appendRow(ProjectItem *item)
Appends a top-level item to the model.
QItemSelectionModel * selectionModel()
Returns the internal selection model.
void clean()
Used to clean the ProjectItemModel of everything but the headers.
void onGuiCamerasAdded(GuiCameraList *cameras)
Slot to connect to the guiCamerasAdded() signal from a Project.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
ProjectItem * item(int row)
Returns the top-level item at the given row.
void onNameChanged(QString newName)
Slot to connect to the nameChanged() signal from a Project.
~ProjectItemModel()
Destructs the model.
List of GuiCameras saved as QSharedPointers.
Definition: GuiCameraList.h:35
Qt::ItemFlags flags(const QModelIndex &index) const
This virtual method was added to handle changing the project name by double-clicking the project name...
void setItem(int row, ProjectItem *item)
Sets the item at the top-level row.
void onRowsInserted(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsInserted() signal from QAbstractItemModel.
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Slot to connect to the selectionChanged() signal from a selection model.
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
void onTemplatesAdded(TemplateList *templateList)
Slot connected to the templatesAdded() signal from a project.
Represents an item of a ProjectItemModel in Qt&#39;s model-view framework.
Definition: ProjectItem.h:146
QList< ProjectItem * > selectedBOSSImages()
ProjectItemModel::selectedBOSSImages.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QItemSelectionModel * m_selectionModel
The internal selection model.
ProjectItemModel(QObject *parent=0)
Constructs an empty model.
void onShapesAdded(ShapeList *shapes)
Slot to connect to the shapesAdded() signal from a Project.
ProjectItem * addProject(Project *project)
Adds a Project to the model.