Commit f530c3c2 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

initial treeview using proxy model for observation settings

parent d188bb2b
Loading
Loading
Loading
Loading
+56 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include "IString.h"
#include "MaximumLikelihoodWFunctions.h"
#include "Project.h"
#include "ProjectItemProxyModel.h"
#include "SpecialPixel.h"
#include "ui_JigsawSetupDialog.h"

@@ -87,6 +88,61 @@ namespace Isis {
    // Update setup dialog with settings from any active (current) settings in jigsaw dialog.

    // initializations for observation solve settings tab
    // Proof-of-concept
//    m_ui->treeView->setModel((QAbstractItemModel*)(m_project->directory()->model()));
    ProjectItemModel *model = m_project->directory()->model();
    qDebug() << "Source model row count: " << model->rowCount();
    ProjectItemProxyModel *proxyModel = new ProjectItemProxyModel(this);
    //proxyModel->setSourceModel(model);

    // Why do we have to do it this way?
    // -- For some reason, the isX() methods in ProjectItem aren't working below.
    for (int i = 0; i < model->rowCount(); i++) {
      ProjectItem *projectItem = model->item(i);
      for (int j = 0; j < projectItem->rowCount(); j++) {
        ProjectItem *imageList = projectItem->child(j);
        if (imageList->text() == "Images") {
          for (int k = 0; k < imageList->rowCount(); k++) {
            ProjectItem *importItem = imageList->child(k);
            proxyModel->addItem(importItem);
          }
        }
      }
    }

//    ProjectItem *root = model->item(0);
//    qDebug() << "root row count : " << root->rowCount();
//    qDebug() << root->isProject();
//    qDebug() << root->child(0)->isProject();
//    ProjectItem *child = static_cast<ProjectItem *>(root->child(0));
//    qDebug() << child->isControlList();
//    qDebug() << child->data().value< ControlList * >();
//    proxyModel->addItem(root->child(0));
//    QVariant value = child->data();
//    qDebug() << value;
//    for (int childIndex = 0; childIndex < root->rowCount(); childIndex++) {
//      ProjectItem *child = root->child(childIndex);

//      if (child->isBundleResults()) qDebug() << "bundleResults @ " << childIndex;
//      if (child->isBundleSettings()) qDebug() << "bundleSettings @ " << childIndex;
//      if (child->isBundleSolutionInfo()) qDebug() << "bundleSolutionInfo @ " << childIndex;
//      if (child->isControl()) qDebug() << "control @ " << childIndex;
//      if (child->isControlList()) qDebug() << "controlList @ " << childIndex;
//      if (child->isCorrelationMatrix()) qDebug() << "correlationMatrix @ " << childIndex;
//      if (child->isImage()) qDebug() << "image @ " << childIndex;
//      if (child->isShape()) qDebug() << "shape @ " << childIndex;
//      if (child->isShapeList()) qDebug() << "shapeList @ " << childIndex;
//      if (child->isProject()) qDebug() << "project @ " << childIndex;
//      if (child->isGuiCamera()) qDebug() << "guiCamera @ " << childIndex;
//      if (child->isTargetBody()) qDebug() << "targetBody @ " << childIndex;
//      if (child->isFileItem()) qDebug() << "fileItem @ " << childIndex;
//      if (child->isTemplate()) qDebug() << "template @ " << childIndex;
//      if (child->isImageList()) qDebug() << "imageList @ " << childIndex;


//    }
    m_ui->treeView->setModel(proxyModel);

    m_ui->spkSolveDegreeSpinBox_2->setValue(-1);

    QStringList tableHeaders;
+11 −11
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@
          </sizepolicy>
         </property>
         <property name="currentIndex">
          <number>0</number>
          <number>1</number>
         </property>
         <widget class="QWidget" name="generalSettingsTab">
          <attribute name="title">
@@ -954,18 +954,18 @@
             <zorder>twistCheckBox_2</zorder>
            </widget>
           </item>
           <item row="0" column="0">
            <spacer name="horizontalSpacer">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
           <item row="0" column="0" rowspan="2">
            <widget class="QTreeView" name="treeView">
             <property name="editTriggers">
              <set>QAbstractItemView::NoEditTriggers</set>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>40</width>
               <height>20</height>
              </size>
             <property name="selectionMode">
              <enum>QAbstractItemView::ExtendedSelection</enum>
             </property>
            </spacer>
             <property name="headerHidden">
              <bool>true</bool>
             </property>
            </widget>
           </item>
          </layout>
         </widget>