23 #include "IsisDebug.h"
27 #include <QItemSelection>
30 #include <QModelIndex>
32 #include <QStandardItemModel>
37 #include "ControlList.h"
38 #include "GuiCameraList.h"
39 #include "ImageList.h"
42 #include "ShapeList.h"
43 #include "TargetBodyList.h"
54 const QItemSelection &) ),
57 connect(
this, SIGNAL(rowsInserted(
const QModelIndex &,
int,
int)),
60 connect(
this, SIGNAL(rowsAboutToBeRemoved(
const QModelIndex &,
int,
int)),
88 Qt::DropAction action,
90 const QModelIndex &parent)
const {
116 connect(project, SIGNAL( nameChanged(QString) ),
120 connect(project, SIGNAL( controlAdded(
Control *) ),
122 connect(project, SIGNAL( controlListAdded(
ControlList *) ),
124 connect(project, SIGNAL( imagesAdded(
ImageList *) ),
126 connect(project, SIGNAL( shapesAdded(
ShapeList *) ),
158 foreach ( QModelIndex index, selection.indexes() ) {
179 for (
int i=0; i<rowCount(); i++) {
204 removeRow( item->row(), parentItem->index() );
208 removeRow( item->row() );
231 QStandardItemModel::appendRow(item);
243 return QStandardItemModel::indexFromItem(item);
254 QStandardItemModel::insertRow(row, item);
266 return static_cast<ProjectItem *
>( QStandardItemModel::item(row) );
278 return static_cast<ProjectItem *
>( QStandardItemModel::itemFromIndex(index) );
289 QStandardItemModel::setItem(row, item);
303 if ( items.isEmpty() ) {
307 return static_cast<ProjectItem *
>( items.first() );
324 for (
int i=0; i<rowCount(); i++) {
326 if (projectItem->
project() == project) {
327 projectItem->setText(newName);
350 for (
int i=0; i<rowCount(); i++) {
352 if (projectItem->
project() == project) {
353 for (
int j=0; j < projectItem->rowCount(); j++) {
355 if (resultsItem->text() ==
"Results") {
379 for (
int i=0; i<rowCount(); i++) {
381 if (projectItem->
project() == project) {
382 for (
int j=0; j < projectItem->rowCount(); j++) {
384 if (controlsItem->text() ==
"Control Networks") {
385 for (
int k=0; k < controlsItem->rowCount(); k++) {
388 if ( controlList && controlList->contains(control) ) {
417 for (
int i=0; i<rowCount(); i++) {
419 if (projectItem->
project() == project) {
420 for (
int j=0; j < projectItem->rowCount(); j++) {
422 if (controlsItem->text() ==
"Control Networks") {
447 for (
int i=0; i<rowCount(); i++) {
449 if (projectItem->
project() == project) {
450 for (
int j=0; j < projectItem->rowCount(); j++) {
452 if (imagesItem->text() ==
"Images") {
475 for (
int i=0; i<rowCount(); i++) {
477 if (projectItem->
project() == project) {
478 for (
int j=0; j < projectItem->rowCount(); j++) {
480 if (shapesItem->text() ==
"Shapes") {
504 for (
int i=0; i<rowCount(); i++) {
506 if (projectItem->
project() == project) {
507 for (
int j=0; j < projectItem->rowCount(); j++) {
509 if (targetsItem->text() ==
"Target Body") {
512 for (
int k=0; k < targetsItem->rowCount(); k++) {
544 for (
int i=0; i<rowCount(); i++) {
546 if (projectItem->
project() == project) {
547 for (
int j=0; j < projectItem->rowCount(); j++) {
549 if (camerasItem->text() ==
"Sensors") {
552 for (
int k=0; k < camerasItem->rowCount(); k++) {
580 const QItemSelection &deselected) {
582 foreach ( QModelIndex index, selected.indexes() ) {
593 foreach ( QModelIndex index, deselected.indexes() ) {
616 for (
int row=start; row <= end; row++) {
617 QModelIndex newIndex = index(row, 0, parent);
634 for (
int row=start; row <= end; row++) {
635 QModelIndex newIndex = index(row, 0, parent);
638 emit itemRemoved(item);
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.
Internalizes a list of shapes and allows for operations on the entire list.
void insertRow(int row, ProjectItem *item)
Inserts a top-level item at the given row.
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.
void onControlAdded(Control *control)
Slot to connect to the controlAdded() signal from a project.
The main project for cnetsuite.
void appendRow(ProjectItem *item)
Appends an item to the children of this item.
ProjectItem * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
TargetBodyQsp targetBody() const
Returns the TargetBodyQsp stored in the data of the item.
Container class for BundleAdjustment results.
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
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.
bool isImage() const
Returns true if an Image is stored in the data of the item.
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 setSelected(bool)
Change the selected state associated with this cube.
void onControlListAdded(ControlList *controlList)
Slot to connect to the controlListAdded() signal from a Project.
ProjectItem * findItemData(const QVariant &value, int role=Qt::UserRole+1)
Finds and returns the first item in the model that contains the data in the role. ...
ProjectItem * parent() const
Returns the parent item of this item.
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.
Project * project() const
Returns the Project stored in the data of the item.
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...
Image * image() const
Returns the Image stored in the data of the item.
void appendRow(ProjectItem *item)
Appends a top-level item to the model.
ControlList * controlList() const
Returns the ControlList stored in the data of the item.
QItemSelectionModel * selectionModel()
Returns the internal selection model.
QSharedPointer< TargetBody > TargetBodyQsp
Defines A smart pointer to a TargetBody obj.
void onGuiCamerasAdded(GuiCameraList *cameras)
Slot to connect to the guiCamerasAdded() signal from a Project.
GuiCameraQsp guiCamera() const
Returns the GuiCameraQsp stored in the data of the item.
virtual void removeItems(QList< ProjectItem * > items)
Removes a list of items and their children from the model.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
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.
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.
QSharedPointer< GuiCamera > GuiCameraQsp
GuiCameraQsp Represents a smart pointer to a GuiCamera object.
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.
Represents an item of a ProjectItemModel in Qt's model-view framework.
QItemSelectionModel * m_selectionModel
The internal selection model.
ProjectItemModel(QObject *parent=0)
Constructs an empty model.
ProjectItem * child(int row) const
Returns the child item at a given row.
void onShapesAdded(ShapeList *shapes)
Slot to connect to the shapesAdded() signal from a Project.
ProjectItem * addProject(Project *project)
Adds a Project to the model.