Loading isis/src/qisis/objs/JigsawSetupDialog/JigsawSetupDialog.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -1128,21 +1128,40 @@ namespace Isis { void JigsawSetupDialog::createObservationSolveSettingsTreeView() { // Proof-of-concept // Proof-of- qDebug() << "JigsawSetupDialog::createObservationSolveSettingsTreeView()"; // m_ui->treeView->setModel((QAbstractItemModel*)(m_project->directory()->model())); ProjectItemModel *model = m_project->directory()->model(); SubTreeProxyModel *osspm = new SubTreeProxyModel; osspm->setSourceModel(model); //QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) // find the root "Images" and set it in the proxy QStandardItem *item = model->invisibleRootItem()->child(0)->child(1); qDebug() << "ITEM: " << item << ", " << item->text(); qDebug() << "PARENT: " << item->parent() << ", " << item->parent()->text(); // i think source model tries to add top root item, which is invalid??? osspm->setRoot(item); //osspm->setRoot(item); m_ui->treeView->setModel(osspm); //Set the root index to display the subtree we are interesting in. This requires //computing the proxy index from the source model. m_ui->treeView->setRootIndex(osspm->mapFromSource(item->index() )); // Try to loop through the view here to add the "groups" so they aren't part of the model Loading isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.cpp +23 −12 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ namespace Isis { QIdentityProxyModel(parent) { } // Returns the model index in the proxy model corresponding to the sourceIndex from the // source model QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { // return QIdentityProxyModel::mapFromSource(sourceIndex); qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; //qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; // QModelIndex parent = sourceIndex.parent(); // int row = sourceIndex.row(); // if (!sourceIndex.isValid()) { Loading @@ -37,18 +38,18 @@ namespace Isis { // First check to see if the source index is the proxy root if (sourceIndex == m_root) { qDebug() << "source exactly matches root already."; //qDebug() << "source exactly matches root already."; return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); } // If the source index is a child of the proxy root, one if its ancestors IS proxy root QModelIndex ancestorIndex = sourceIndex.parent(); QString n = ""; qDebug() << ancestorIndex; //qDebug() << ancestorIndex; while (ancestorIndex.isValid() && ancestorIndex != m_root) { ancestorIndex = ancestorIndex.parent(); n += "\t"; qDebug() << n << ancestorIndex; //qDebug() << n << ancestorIndex; } if (ancestorIndex.isValid()) { return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); Loading Loading @@ -96,7 +97,8 @@ namespace Isis { // return QIdentityProxyModel::mapFromSource(sourceIndex); } //Returns the model index in the source that corresponds to the proxy index //in the proxy model QModelIndex SubTreeProxyModel::mapToSource(const QModelIndex &proxyIndex) const { // return proxyIndex; return QIdentityProxyModel::mapToSource(proxyIndex); Loading @@ -117,12 +119,12 @@ namespace Isis { if (persistentIndex.isValid()) { qDebug() << "persistent index is valid: " << persistentIndex; qDebug() << "parent index: " << persistentIndex.parent(); //qDebug() << "persistent index is valid: " << persistentIndex; //qDebug() << "parent index: " << persistentIndex.parent(); m_root = persistentIndex; } else { qDebug() << "persistent index NOT valid."; //qDebug() << "persistent index NOT valid."; m_root = QPersistentModelIndex(QModelIndex()); } Loading @@ -137,13 +139,22 @@ namespace Isis { bool SubTreeProxyModel::setRoot(const QStandardItem *item) { qDebug() << "setRoot() item->index() " << item->index(); qDebug() << "\titem->parent()->index() " << item->parent()->index(); m_root = QPersistentModelIndex(item->index()); qDebug() << "Perisentent Model Index ROOT: " << m_root << " is valid ? " << (m_root.isValid() ? "yes" : "no"); //m_root = QPersistentModelIndex(item->index()); QAbstractItemModel::removeRows(1,2,item->index()); //qDebug() << "Perisentent Model Index ROOT: " << m_root << " is valid ? " << (m_root.isValid() ? "yes" : "no"); qDebug() << "Persistent's PARENT: " << m_root.parent(); if (m_root.isValid()) { qDebug() <<"m_root is valid"; return true; } else { qDebug() <<"m_root is not valid"; return false; } } Loading isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.h +1 −0 Original line number Diff line number Diff line #ifndef SubTreeProxyModel_h #define SubTreeProxyModel_h Loading Loading
isis/src/qisis/objs/JigsawSetupDialog/JigsawSetupDialog.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -1128,21 +1128,40 @@ namespace Isis { void JigsawSetupDialog::createObservationSolveSettingsTreeView() { // Proof-of-concept // Proof-of- qDebug() << "JigsawSetupDialog::createObservationSolveSettingsTreeView()"; // m_ui->treeView->setModel((QAbstractItemModel*)(m_project->directory()->model())); ProjectItemModel *model = m_project->directory()->model(); SubTreeProxyModel *osspm = new SubTreeProxyModel; osspm->setSourceModel(model); //QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) // find the root "Images" and set it in the proxy QStandardItem *item = model->invisibleRootItem()->child(0)->child(1); qDebug() << "ITEM: " << item << ", " << item->text(); qDebug() << "PARENT: " << item->parent() << ", " << item->parent()->text(); // i think source model tries to add top root item, which is invalid??? osspm->setRoot(item); //osspm->setRoot(item); m_ui->treeView->setModel(osspm); //Set the root index to display the subtree we are interesting in. This requires //computing the proxy index from the source model. m_ui->treeView->setRootIndex(osspm->mapFromSource(item->index() )); // Try to loop through the view here to add the "groups" so they aren't part of the model Loading
isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.cpp +23 −12 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ namespace Isis { QIdentityProxyModel(parent) { } // Returns the model index in the proxy model corresponding to the sourceIndex from the // source model QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { // return QIdentityProxyModel::mapFromSource(sourceIndex); qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; //qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; // QModelIndex parent = sourceIndex.parent(); // int row = sourceIndex.row(); // if (!sourceIndex.isValid()) { Loading @@ -37,18 +38,18 @@ namespace Isis { // First check to see if the source index is the proxy root if (sourceIndex == m_root) { qDebug() << "source exactly matches root already."; //qDebug() << "source exactly matches root already."; return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); } // If the source index is a child of the proxy root, one if its ancestors IS proxy root QModelIndex ancestorIndex = sourceIndex.parent(); QString n = ""; qDebug() << ancestorIndex; //qDebug() << ancestorIndex; while (ancestorIndex.isValid() && ancestorIndex != m_root) { ancestorIndex = ancestorIndex.parent(); n += "\t"; qDebug() << n << ancestorIndex; //qDebug() << n << ancestorIndex; } if (ancestorIndex.isValid()) { return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); Loading Loading @@ -96,7 +97,8 @@ namespace Isis { // return QIdentityProxyModel::mapFromSource(sourceIndex); } //Returns the model index in the source that corresponds to the proxy index //in the proxy model QModelIndex SubTreeProxyModel::mapToSource(const QModelIndex &proxyIndex) const { // return proxyIndex; return QIdentityProxyModel::mapToSource(proxyIndex); Loading @@ -117,12 +119,12 @@ namespace Isis { if (persistentIndex.isValid()) { qDebug() << "persistent index is valid: " << persistentIndex; qDebug() << "parent index: " << persistentIndex.parent(); //qDebug() << "persistent index is valid: " << persistentIndex; //qDebug() << "parent index: " << persistentIndex.parent(); m_root = persistentIndex; } else { qDebug() << "persistent index NOT valid."; //qDebug() << "persistent index NOT valid."; m_root = QPersistentModelIndex(QModelIndex()); } Loading @@ -137,13 +139,22 @@ namespace Isis { bool SubTreeProxyModel::setRoot(const QStandardItem *item) { qDebug() << "setRoot() item->index() " << item->index(); qDebug() << "\titem->parent()->index() " << item->parent()->index(); m_root = QPersistentModelIndex(item->index()); qDebug() << "Perisentent Model Index ROOT: " << m_root << " is valid ? " << (m_root.isValid() ? "yes" : "no"); //m_root = QPersistentModelIndex(item->index()); QAbstractItemModel::removeRows(1,2,item->index()); //qDebug() << "Perisentent Model Index ROOT: " << m_root << " is valid ? " << (m_root.isValid() ? "yes" : "no"); qDebug() << "Persistent's PARENT: " << m_root.parent(); if (m_root.isValid()) { qDebug() <<"m_root is valid"; return true; } else { qDebug() <<"m_root is not valid"; return false; } } Loading
isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.h +1 −0 Original line number Diff line number Diff line #ifndef SubTreeProxyModel_h #define SubTreeProxyModel_h Loading