Isis 3 Programmer Reference
ProjectItemModel.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ProjectItemModel.h"
10#include <QDebug>
11#include <QItemSelection>
12#include <QList>
13#include <QMessageBox>
14#include <QMimeData>
15#include <QModelIndex>
16#include <QObject>
17#include <QRegExp>
18#include <QRegExpValidator>
19#include <QStandardItemModel>
20#include <QString>
21#include <QValidator>
22
23#include "BundleSolutionInfo.h"
24#include "Control.h"
25#include "ControlList.h"
26#include "FileItem.h"
27#include "GuiCameraList.h"
28#include "ImageList.h"
29#include "Project.h"
30#include "ProjectItem.h"
31#include "ShapeList.h"
32#include "TargetBodyList.h"
33#include "TemplateList.h"
34
35
36namespace Isis {
43 m_selectionModel = new QItemSelectionModel(this, this);
44 connect(m_selectionModel, SIGNAL(selectionChanged(const QItemSelection &,
45 const QItemSelection &) ),
46 this, SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &) ) );
47
48 connect( this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
49 this, SLOT(onRowsInserted(const QModelIndex &, int, int)) );
50
51 connect( this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
52 this, SLOT(onRowsRemoved(const QModelIndex &, int, int)) );
53
54 }
55
56
63
64
78 bool ProjectItemModel::canDropMimeData(const QMimeData *data,
79 Qt::DropAction action,
80 int row, int column,
81 const QModelIndex &parent) const {
82 return false;
83 }
84
85
91 QItemSelectionModel *ProjectItemModel::selectionModel() {
92 return m_selectionModel;
93 }
94
95
106
107 connect(project, SIGNAL( nameChanged(QString) ),
108 this, SLOT( onNameChanged(QString) ) );
109 connect(project, SIGNAL( bundleSolutionInfoAdded(BundleSolutionInfo *) ),
111 connect(project, SIGNAL( controlAdded(Control *) ),
112 this, SLOT( onControlAdded(Control *) ) );
113 connect(project, SIGNAL( controlListAdded(ControlList *) ),
114 this, SLOT( onControlListAdded(ControlList *) ) );
115 connect(project, SIGNAL( imagesAdded(ImageList *) ),
116 this, SLOT( onImagesAdded(ImageList *) ) );
117 connect(project, SIGNAL( shapesAdded(ShapeList *) ),
118 this, SLOT( onShapesAdded(ShapeList *) ) );
119 connect(project, SIGNAL( targetsAdded(TargetBodyList *) ),
120 this, SLOT( onTargetsAdded(TargetBodyList *) ) );
121 connect(project, SIGNAL( templatesAdded(TemplateList *)),
122 this, SLOT( onTemplatesAdded(TemplateList *)));
123 connect(project, SIGNAL( guiCamerasAdded(GuiCameraList *) ),
124 this, SLOT( onGuiCamerasAdded(GuiCameraList *) ) );
125 ProjectItem *projectItem = new ProjectItem(project);
126 appendRow(projectItem);
127// qDebug()<<"ProjectItem::addProject after appendRow projectItem rowCount = "<<rowCount();
128 return projectItem;
129 }
130
131
138
139 ProjectItem *item = itemFromIndex( selectionModel()->currentIndex() );
140
141 // We do this because if the user was in a footprint or cubeDN view, then
142 // There is no valid currentIndex(). In that case, we grab whichever item
143 // was right clicked that triggered this call.
144 if (item == NULL) {
145 item = selectedItems().at(0);
146 }
147 return item;
148 }
149
150
156 QList<ProjectItem *> ProjectItemModel::selectedItems() {
157 QItemSelection selection = selectionModel()->selection();
158 QList<ProjectItem *> items;
159
160
161 foreach ( QModelIndex index, selection.indexes() ) {
162 items.append( itemFromIndex(index) );
163 }
164
165 return items;
166 }
176
177 QItemSelection selection = selectionModel()->selection();
178 QList<ProjectItem *> items;
179 QModelIndexList indices = selection.indexes();
180
181 // If nothing is selected, fill items with all image lists and images.
182 if (indices.size() == 0) {
183 ProjectItem *imageRoot = findItemData(QVariant("Images"), 0);
184 items.append(imageRoot);
185 for (int i = 0; i < imageRoot->rowCount(); i++) {
186 ProjectItem *imglistItem = imageRoot->child(i);
187 items.append(imglistItem);
188 for (int j = 0; j < imglistItem->rowCount(); j++) {
189 ProjectItem *imgItem = imglistItem->child(j);
190 if (imgItem->isImage()) {
191 items.append(imgItem);
192 }
193 }
194 }
195 return items;
196 }
197
198 //Query the selected items to see if they have children
199 foreach ( QModelIndex ix, indices ) {
200
201 ProjectItem *item = this->itemFromIndex(ix);
202
203 //Anything that is not an image or an image list does
204 //not make sense to display in the BOSS treeview tab,
205 //so we need to exclude these items.
206 if (item->isImageList() || item->isImage() ) {
207 items.append( item );
208 }
209 else {
210 return items;
211 }
212
213 //If the selected ImageList has children, we have to handle
214 //the case where some of the children are selected, or
215 //the possibility that the user wants all of the children selected.
216 if (this->hasChildren(ix)) {
217
218 //If the node has children, loop through all of them
219 //and add them to selected items.
220 bool childrenSelected(false);
221 int numChildren = this->rowCount(ix);
222
223 //First loop through the children to see if any of them are also selected
224 for (int i = 0; i < numChildren;i++) {
225 QModelIndex ixchild = this->index(i,0,ix);
226 if (indices.contains(ixchild) ){
227 childrenSelected=true;
228 break;
229 }
230 }
231 //If they are, then add them to selected items
232 if (childrenSelected) {
233 for (int i =0;i < numChildren;i++) {
234 QModelIndex ixchild = this->index(i,0,ix);
235 if (indices.contains(ixchild))
236 items.append(this->itemFromIndex(ixchild ));
237 }
238 }
239 //No children selected, so we are assuming that the user
240 //wanted to select all of the children under the parent.
241 else {
242 for (int i =0;i < numChildren;i++) {
243 QModelIndex ixchild = this->index(i,0,ix);
244 items.append(this->itemFromIndex(ixchild ));
245 }
246
247 }
248
249 }//end if
250
251 //Append the parent of any selected child. This is so
252 //the children aren't hanging on the tree without
253 //a collapsible parent node.
254 if( item->parent() ->hasChildren()) {
255 ProjectItem * parent = item->parent();
256 if (!items.contains(parent)){
257 items.append(parent);
258 }// end inner if
259 }//end outer if
260 //Also include the grandparent. This handles the event
261 //that we may have multiple image lists selected to the treeview
262 //and we need a grandparent node attached to group them under.
263 if (this->itemFromIndex(ix)->parent()->parent() ){
264 ProjectItem *grandparent = this->itemFromIndex(ix)->parent()->parent();
265 if (!items.contains(grandparent)) {
266 items.append(grandparent);
267 } //end inner if
268
269 } //end outer if
270
271 }// end foreach
272
273 return items;
274
275 }
276
277
288 ProjectItem *ProjectItemModel::findItemData(const QVariant &data, int role) {
289
290// qDebug()<<"ProjectItemModel::findItemData incoming data = "<<data;
291 for (int i=0; i<rowCount(); i++) {
292// qDebug()<<"ProjectItemModel::findItemData BEFORE call: item(i)->findItemData...";
293 ProjectItem *projectItem = item(i)->findItemData(data, role);
294// qDebug()<<"ProjectItemModel::findItemData AFTER call: item(i)->findItemData...";
295 if (projectItem) {
296 return projectItem;
297 }
298 }
299
300 return 0;
301 }
302
303
314 if (!item) {
315 return;
316 }
317
318 // remove any children the item has first
319 if (item->hasChildren()) {
320 for (int row = (item->rowCount() - 1); row >= 0; row--) {
321 removeRow(item->child(row)->row(), item->index());
322 }
323 }
324
325 if (ProjectItem *parentItem = item->parent()) {
326 // remove the item from its parent
327 removeRow(item->row(), parentItem->index());
328 }
329 else {
330 removeRow(item->row());
331 }
332 }
333
334
340 void ProjectItemModel::removeItems(QList<ProjectItem *> items) {
341 foreach (ProjectItem *item, items) {
343 }
344 }
345
346
353 QStandardItemModel::appendRow(item);
354 }
355
356
365 return QStandardItemModel::indexFromItem(item);
366 }
367
368
376 QStandardItemModel::insertRow(row, item);
377 }
378
379
388 return static_cast<ProjectItem *>( QStandardItemModel::item(row) );
389 }
390
391
399 ProjectItem *ProjectItemModel::itemFromIndex(const QModelIndex &index) {
400 return static_cast<ProjectItem *>( QStandardItemModel::itemFromIndex(index) );
401 }
402
403
411 QStandardItemModel::setItem(row, item);
412 }
413
414
423 QList<QStandardItem *> items = QStandardItemModel::takeRow(row);
424
425 if ( items.isEmpty() ) {
426 return 0;
427 }
428
429 return static_cast<ProjectItem *>( items.first() );
430 }
431
432
439 void ProjectItemModel::onNameChanged(QString newName) {
440 Project *project = qobject_cast<Project *>( sender() );
441
442 if (!project) {
443 return;
444 }
445
446 for (int i=0; i<rowCount(); i++) {
447 ProjectItem *projectItem = item(i);
448 if (projectItem->project() == project) {
449 projectItem->setText(newName);
450 }
451 }
452 project->setClean(false);
453 }
454
455
467 Project *project = qobject_cast<Project *>( sender() );
468 m_reservedNames.append(bundleSolutionInfo->name() );
469
470 if (!project) {
471 return;
472 }
473
474 for (int i=0; i<rowCount(); i++) {
475 ProjectItem *projectItem = item(i);
476 if (projectItem->project() == project) {
477 for (int j=0; j < projectItem->rowCount(); j++) {
478 ProjectItem *resultsItem = projectItem->child(j);
479 if (resultsItem->text() == "Results") {
480 ProjectItem *pItem = new ProjectItem(bundleSolutionInfo);
481 resultsItem->appendRow( pItem );
482
483 // Append text bundle summary and CSV files to the Statistics in the project
484 ProjectItem *bundleSummaryItem = new ProjectItem(FileItemQsp(
485 new FileItem(bundleSolutionInfo->savedBundleOutputFilename())),
486 "Summary", bundleSolutionInfo->savedBundleOutputFilename(),
487 QIcon(FileName("$ISISROOT/appdata/images/icons/office-chart-pie.png")
488 .expanded()));
489 pItem->child(2)->appendRow(bundleSummaryItem);
490 ProjectItem *residualsItem = new ProjectItem(FileItemQsp(
491 new FileItem(bundleSolutionInfo->savedResidualsFilename())),
492 "Measure Residuals", bundleSolutionInfo->savedResidualsFilename(),
493 QIcon(FileName("$ISISROOT/appdata/images/icons/office-chart-pie.png")
494 .expanded()));
495 pItem->child(2)->appendRow(residualsItem);
496 ProjectItem *imagesItem = new ProjectItem(FileItemQsp(
497 new FileItem(bundleSolutionInfo->savedImagesFilename())),
498 "Image", bundleSolutionInfo->savedImagesFilename(),
499 QIcon(FileName("$ISISROOT/appdata/images/icons/office-chart-pie.png")
500 .expanded()));
501 pItem->child(2)->appendRow(imagesItem);
502 ProjectItem *pointsItem = new ProjectItem(FileItemQsp(
503 new FileItem(bundleSolutionInfo->savedPointsFilename())),
504 "Control Points", bundleSolutionInfo->savedPointsFilename(),
505 QIcon(FileName("$ISISROOT/appdata/images/icons/office-chart-pie.png")
506 .expanded()));
507 pItem->child(2)->appendRow(pointsItem);
508 }
509 }
510 }
511 }
512 }
513
514
524 Project *project = qobject_cast<Project *>( sender() );
525 if (!project) { return; }
526
527 // Start at our project's node
528 // Start at our project's node
529 for (int i = 0; i<rowCount(); i++) {
530 ProjectItem *projectItem = item(i);
531 if (projectItem->project() == project) {
532
533 // Find the "Templates" node
534 for (int j = 0; j < projectItem->rowCount(); j++) {
535 ProjectItem *templatesItem = projectItem->child(j);
536 if (templatesItem->text() == "Templates"){
537
538 // Find either the "Maps" or "Registrations" node
539 QString type = templateList->type();
540 for (int k = 0; k < templatesItem->rowCount(); k++) {
541 ProjectItem *templateType = templatesItem->child(k);
542 if (templateType->text().toLower() == type) {
543 templateType->appendRow( new ProjectItem(templateList));
544 }
545 }
546 }
547 }
548 }
549 }
550 }
551
552
562 Project *project = qobject_cast<Project *>( sender() );
563 m_reservedNames.append(control->id() );
564
565 if (!project) {
566 return;
567 }
568
569 for (int i=0; i<rowCount(); i++) {
570 ProjectItem *projectItem = item(i);
571 if (projectItem->project() == project) {
572 for (int j=0; j < projectItem->rowCount(); j++) {
573 ProjectItem *controlsItem = projectItem->child(j);
574 if (controlsItem->text() == "Control Networks") {
575 for (int k=0; k < controlsItem->rowCount(); k++) {
576 ProjectItem *controlListItem = controlsItem->child(k);
577 ControlList *controlList = controlListItem->controlList();
578 if ( controlList && controlList->contains(control) ) {
579 controlListItem->appendRow( new ProjectItem(control) );
580 }
581 }
582 }
583 }
584 }
585 }
586// qDebug()<<"ProjectItemModel::onControlAdded rowCount = "<<rowCount();
587 }
588
589
601 Project *project = qobject_cast<Project *>( sender() );
602 m_reservedNames.append(controlList->name() );
603
604 if (!project) {
605 return;
606 }
607
608 for (int i=0; i<rowCount(); i++) {
609 ProjectItem *projectItem = item(i);
610 if (projectItem->project() == project) {
611 for (int j=0; j < projectItem->rowCount(); j++) {
612 ProjectItem *controlsItem = projectItem->child(j);
613 if (controlsItem->text() == "Control Networks") {
614 controlsItem->appendRow( new ProjectItem(controlList) );
615 }
616 }
617 }
618 }
619 }
620
621
631// qDebug()<<"ProjectItemModel::onImagesAdded before add rowCount = "<<rowCount();
632 Project *project = qobject_cast<Project *>( sender() );
633 m_reservedNames.append(imageList->name() );
634 if (!project) {
635 return;
636 }
637
638 for (int i=0; i<rowCount(); i++) {
639 ProjectItem *projectItem = item(i);
640 if (projectItem->project() == project) {
641 for (int j=0; j < projectItem->rowCount(); j++) {
642 ProjectItem *imagesItem = projectItem->child(j);
643 if (imagesItem->text() == "Images") {
644 imagesItem->appendRow( new ProjectItem(imageList) );
645 }
646 }
647 }
648 }
649// qDebug()<<"ProjectItemModel::onImagesAdded after add rowCount = "<<rowCount();
650 }
651
652
661 Project *project = qobject_cast<Project *>( sender() );
662 m_reservedNames.append(shapes->name());
663
664 if (!project) {
665 return;
666 }
667 for (int i=0; i<rowCount(); i++) {
668 ProjectItem *projectItem = item(i);
669 if (projectItem->project() == project) {
670 for (int j=0; j < projectItem->rowCount(); j++) {
671 ProjectItem *shapesItem = projectItem->child(j);
672 if (shapesItem->text() == "Shapes") {
673 shapesItem->appendRow( new ProjectItem(shapes) );
674 }
675 }
676 }
677 }
678 }
679
680
690 Project *project = qobject_cast<Project *>( sender() );
691 m_reservedNames.append(targets->name() );
692
693 if (!project) {
694 return;
695 }
696
697 for (int i=0; i<rowCount(); i++) {
698 ProjectItem *projectItem = item(i);
699 if (projectItem->project() == project) {
700 for (int j=0; j < projectItem->rowCount(); j++) {
701 ProjectItem *targetsItem = projectItem->child(j);
702 if (targetsItem->text() == "Target Body") {
703 foreach(TargetBodyQsp target, *targets) {
704 bool append = true;
705 for (int k=0; k < targetsItem->rowCount(); k++) {
706 ProjectItem *targetItem = targetsItem->child(k);
707 if (targetItem->targetBody() == target) {
708 append = false;
709 }
710 }
711 if (append) {
712 targetsItem->appendRow( new ProjectItem(target) );
713 }
714 }
715 }
716 }
717 }
718 }
719 }
720
721
731 Project *project = qobject_cast<Project *>( sender() );
732 m_reservedNames.append(cameras->name() );
733
734 if (!project) {
735 return;
736 }
737
738 for (int i=0; i<rowCount(); i++) {
739 ProjectItem *projectItem = item(i);
740 if (projectItem->project() == project) {
741 for (int j=0; j < projectItem->rowCount(); j++) {
742 ProjectItem *camerasItem = projectItem->child(j);
743 if (camerasItem->text() == "Sensors") {
744 foreach(GuiCameraQsp camera, *cameras) {
745 bool append = true;
746 for (int k=0; k < camerasItem->rowCount(); k++) {
747 ProjectItem *cameraItem = camerasItem->child(k);
748 if (cameraItem->guiCamera() == camera) {
749 append = false;
750 }
751 }
752 if (append) {
753 camerasItem->appendRow( new ProjectItem(camera) );
754 }
755 }
756 }
757 }
758 }
759 }
760 }
761
762
773 void ProjectItemModel::onSelectionChanged(const QItemSelection &selected,
774 const QItemSelection &deselected) {
775 QList<ProjectItem *> selectedItems;
776 foreach ( QModelIndex index, selected.indexes() ) {
777 selectedItems.append( itemFromIndex(index) );
778 }
779
780 foreach (ProjectItem *item, selectedItems) {
781 if ( item->isImage() ) {
783 }
784 }
785
786 QList<ProjectItem *> deselectedItems;
787 foreach ( QModelIndex index, deselected.indexes() ) {
788 deselectedItems.append( itemFromIndex(index) );
789 }
790
791 foreach (ProjectItem *item, deselectedItems) {
792 if ( item->isImage() ) {
794 }
795 }
796
797 }
798
799
810 void ProjectItemModel::onRowsInserted(const QModelIndex &parent, int start, int end) {
811 for (int row=start; row <= end; row++) {
812 QModelIndex newIndex = index(row, 0, parent);
813 ProjectItem *item = itemFromIndex(newIndex);
814 emit itemAdded(item);
815 }
816 }
817
818
828 void ProjectItemModel::onRowsRemoved(const QModelIndex &parent, int start, int end) {
829 for (int row=start; row <= end; row++) {
830 QModelIndex newIndex = index(row, 0, parent);
831 ProjectItem *item = itemFromIndex(newIndex);
832// qDebug()<<"ProjectItemModel::onRowsRemoved this = "<<this<<" item = "<<item;
833 emit itemRemoved(item);
834 }
835// qDebug()<<"ProjectItemModel::onRowsRemoved Source model : "<<this<<" row count = "<<rowCount();
836 }
837
838
852 bool ProjectItemModel::setData(const QModelIndex &index, const QVariant &value, int role) {
853
855
856 QString name = value.toString();
857
858 bool rejected =rejectName(m_reservedNames,name);
859
860 if (rejected) {
861 QMessageBox nameRejected;
862 nameRejected.setText("That name is already in use within this project.");
863 nameRejected.exec();
864 return true;
865 }
866
867 m_reservedNames.append(name);
868
869 if (item->isProject() && role == Qt::EditRole) {
870 emit projectNameEdited(name);
871 }
872
873 else if (item->isBundleSolutionInfo() && role == Qt::EditRole) {
874 item->setText(name);
876 emit cleanProject(false);
877 }
878 else if (item->isImageList() && role == Qt::EditRole) {
879 item->setText(name);
880 item->imageList()->setName(name);
881 emit cleanProject(false);
882 }
883 else if (item->isControlList() && role == Qt::EditRole) {
884 item->setText(name);
885 item->controlList()->setName(name);
886 emit cleanProject(false);
887 }
888 else if (item->isShapeList() && role == Qt::EditRole) {
889 item->setText(name);
890 item->shapeList()->setName(name);
891 emit cleanProject(false);
892 }
893 else if (item->isTemplate() && role == Qt::EditRole) {
894 item->setText(name);
895 emit cleanProject(false);
896 }
897 return true;
898 }
899
900
912 Qt::ItemFlags ProjectItemModel::flags(const QModelIndex &index) const {
913
914 return Qt::ItemIsEditable | QStandardItemModel::flags(index);
915 }
916
917
918
927 bool ProjectItemModel::rejectName(QStringList &reserved, QString target) {
928
929
930 QRegExpValidator valid;
931 QValidator::State state;
932 int pos =0;
933 foreach (QString name, reserved) {
934
935 QRegExp rx(name);
936 valid.setRegExp(rx);
937 state = valid.validate(target,pos);
938
939 if (state == 2) {
940 return true;
941 }
942 } //end for
943
944 return false;
945 }
946
951 for (int i=0; i<rowCount(); i++) {
952 ProjectItem *projectItem = item(i);
953 if (projectItem->project()) {
954 for (int j=0; j < projectItem->rowCount(); j++) {
955 if (projectItem->hasChildren()) {
956 ProjectItem *subProjectItem = projectItem->child(j);
957
958 // The header "Templates" has two subheaders that we want to keep
959 if (subProjectItem->text() == "Templates") {
960 if (subProjectItem->hasChildren()) {
961 for (int k=0; k < subProjectItem->rowCount(); k++) {
962 ProjectItem *tempProjectItem = subProjectItem->child(k);
963 while (tempProjectItem->hasChildren()) {
964 removeItem(tempProjectItem->child(0));
965 }
966 }
967 }
968 }
969 else {
970 while (subProjectItem->hasChildren()) {
971 removeItem(subProjectItem->child(0));
972 }
973 }
974 }
975 }
976 }
977 }
978 }
979
980
981}
Container class for BundleAdjustment results.
QString savedPointsFilename()
Returns filename of output bundle points csv file.
void setName(QString name)
Sets the name of the bundle.
QString savedResidualsFilename()
Returns filename of output bundle residuals csv file.
QString name() const
Returns the name of the bundle.
QString savedBundleOutputFilename()
Returns bundleout text filename.
QString savedImagesFilename()
Returns filename of output bundle images csv file.
This represents an ISIS control net in a project-based GUI interface.
Definition Control.h:66
QString id() const
Access the unique ID associated with this Control.
Definition Control.cpp:282
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
Definition ControlList.h:44
QString name() const
Get the human-readable name of this control list.
void setName(QString newName)
Set the human-readable name of this control list.
A container for a filename to be represented as a ProjectItem on the project tree.
Definition FileItem.h:28
File name manipulation and expansion.
Definition FileName.h:100
List of GuiCameras saved as QSharedPointers.
void setSelected(bool)
Change the selected state associated with this cube.
ImageDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this image.
Definition Image.cpp:320
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:55
void setName(QString newName)
Set the human-readable name of this image list.
QString name() const
Get the human-readable name of this image list.
The main project for ipce.
Definition Project.h:289
void setClean(bool value)
Function to change the clean state of the project.
Definition Project.cpp:1594
Represents an item of a ProjectItemModel in Qt's model-view framework.
void appendRow(ProjectItem *item)
Appends an item to the children of this item.
BundleSolutionInfo * bundleSolutionInfo() const
Returns the BundleSolutionInfo stored in the data of the item.
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.
bool isProject() const
Returns true if a Project is stored in the data of the item.
ShapeList * shapeList() const
Returns the ShapeList stored in the data of the item.
bool isControlList() const
Returns true if a ControlList is stored in the data of the item.
bool isShapeList() const
Returns true if an ShapeList is stored in the data of the item.
bool isImageList() const
Returns true if an ImageList is stored in the data of the item.
ProjectItem * parent() const
Returns the parent item of this item.
ImageList * imageList() const
Returns the ImageList stored in the data of the item.
Image * image() const
Returns the Image stored in the data of the item.
ControlList * controlList() const
Returns the ControlList stored in the data of the item.
bool isBundleSolutionInfo() const
Returns true if a BundleSolutionInfo is stored in the data of the item.
bool isImage() const
Returns true if an Image is stored in the data of the item.
ProjectItem * child(int row) const
Returns the child item at a given row.
void onTargetsAdded(TargetBodyList *targets)
Slot to connect to the targetsAdded() signal from a Project.
ProjectItemModel(QObject *parent=0)
Constructs an empty model.
QList< ProjectItem * > selectedItems()
Returns a list of the selected items of the internal selection model.
void cleanProject(bool)
This signal is emitted whrn a ProjectItem's name is changed.
void onImagesAdded(ImageList *images)
Slot to connect to the imagesAdded() signal from a Project.
void appendRow(ProjectItem *item)
Appends a top-level item to the model.
void onGuiCamerasAdded(GuiCameraList *cameras)
Slot to connect to the guiCamerasAdded() signal from a Project.
void onBundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo)
Slot to connect to the bundleSolutionInfoAdded() signal from a project.
void clean()
Used to clean the ProjectItemModel of everything but the headers.
void insertRow(int row, ProjectItem *item)
Inserts a top-level item at the given row.
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Slot to connect to the selectionChanged() signal from a selection model.
void setItem(int row, ProjectItem *item)
Sets the item at the top-level 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.
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 * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
ProjectItem * takeItem(int row)
Removes the top-level row and returns the removed item.
~ProjectItemModel()
Destructs the model.
QList< ProjectItem * > selectedBOSSImages()
ProjectItemModel::selectedBOSSImages.
void onControlListAdded(ControlList *controlList)
Slot to connect to the controlListAdded() signal from a Project.
void itemAdded(ProjectItem *)
This signal is emitted when a ProjectItem is added to the model.
ProjectItem * item(int row)
Returns the top-level item at the given row.
bool rejectName(QStringList &reserved, QString target)
Checks to see if we are adding a reserved name to the project (ex.
virtual void removeItems(QList< ProjectItem * > items)
Removes a list of items and their children from the model.
void onNameChanged(QString newName)
Slot to connect to the nameChanged() signal from a Project.
void onTemplatesAdded(TemplateList *templateList)
Slot connected to the templatesAdded() signal from a project.
void onControlAdded(Control *control)
Slot to connect to the controlAdded() signal from a project.
ProjectItem * addProject(Project *project)
Adds a Project to the model.
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...
ProjectItem * currentItem()
Returns the current item of the internal selection model.
void projectNameEdited(QString)
This signal is emitted when the project name is edited.
QModelIndex indexFromItem(const ProjectItem *item)
Returns the QModelIndex corresponding to a given ProjectItem.
void itemRemoved(ProjectItem *)
This signal is emitted when a ProjectItem is removed to the model.
QItemSelectionModel * m_selectionModel
The internal selection model.
void onRowsInserted(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsInserted() signal from QAbstractItemModel.
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
void onRowsRemoved(const QModelIndex &parent, int start, int end)
Slot to connect to the rowsAboutToBeRemoved() signal from QAbstractItemModel.
void onShapesAdded(ShapeList *shapes)
Slot to connect to the shapesAdded() signal from a Project.
Qt::ItemFlags flags(const QModelIndex &index) const
This virtual method was added to handle changing the project name by double-clicking the project name...
QItemSelectionModel * selectionModel()
Returns the internal selection model.
Internalizes a list of shapes and allows for operations on the entire list.
Definition ShapeList.h:33
void setName(QString newName)
Set the human-readable name of this shape list.
QString name() const
Get the human-readable name of this shape list.
List for holding TargetBodies.
QString type() const
Get the type of template in this TemplateList.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QSharedPointer< FileItem > FileItemQsp
A FileItem smart pointer.
Definition FileItem.h:36