Loading isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -13,11 +13,12 @@ namespace Isis { ObservationSolveSettingsProxyModel::ObservationSolveSettingsProxyModel(QObject *parent) : QIdentityProxyModel(parent) { SubTreeProxyModel::SubTreeProxyModel(QObject *parent) : QIdentityProxyModel(parent) { } QModelIndex ObservationSolveSettingsProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { // return QIdentityProxyModel::mapFromSource(sourceIndex); qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; // QModelIndex parent = sourceIndex.parent(); Loading @@ -26,6 +27,11 @@ namespace Isis { // return m_root; // } // check if the model index corresponds to the invisible root item in source model if (sourceIndex == static_cast<QStandardItemModel *>(sourceModel())->invisibleRootItem()->index()) { return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); } // First check to see if the source index is the proxy root if (sourceIndex == m_root) { qDebug() << "source exactly matches root already."; Loading Loading @@ -88,13 +94,13 @@ namespace Isis { } QModelIndex ObservationSolveSettingsProxyModel::mapToSource(const QModelIndex &proxyIndex) const { QModelIndex SubTreeProxyModel::mapToSource(const QModelIndex &proxyIndex) const { // return proxyIndex; return QIdentityProxyModel::mapToSource(proxyIndex); } void ObservationSolveSettingsProxyModel::setSourceModel(QAbstractItemModel *newSourceModel) { void SubTreeProxyModel::setSourceModel(QAbstractItemModel *newSourceModel) { // QVariant data = newSourceModel->data(newSourceModel->index(0,0,QModelIndex())); // qDebug() << data; // qDebug() << "can convert to project item: " << data.canConvert<ProjectItem *>(); Loading Loading @@ -125,7 +131,7 @@ namespace Isis { } bool ObservationSolveSettingsProxyModel::setRoot(const QStandardItem *item) { bool SubTreeProxyModel::setRoot(const QStandardItem *item) { qDebug() << "setRoot() item->index() " << item->index(); qDebug() << "\titem->parent()->index() " << item->parent()->index(); m_root = QPersistentModelIndex(item->index()); Loading isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.h +3 −3 Original line number Diff line number Diff line Loading @@ -12,11 +12,11 @@ class QVariant; namespace Isis { class ObservationSolveSettingsProxyModel : public QIdentityProxyModel { class SubTreeProxyModel : public QIdentityProxyModel { Q_OBJECT public: explicit ObservationSolveSettingsProxyModel(QObject *parent = 0); explicit SubTreeProxyModel(QObject *parent = 0); QModelIndex mapFromSource(const QModelIndex &sourceIndex) const Q_DECL_OVERRIDE; QModelIndex mapToSource(const QModelIndex &proxyIndex) const Q_DECL_OVERRIDE; Loading Loading
isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -13,11 +13,12 @@ namespace Isis { ObservationSolveSettingsProxyModel::ObservationSolveSettingsProxyModel(QObject *parent) : QIdentityProxyModel(parent) { SubTreeProxyModel::SubTreeProxyModel(QObject *parent) : QIdentityProxyModel(parent) { } QModelIndex ObservationSolveSettingsProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { QModelIndex SubTreeProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { // return QIdentityProxyModel::mapFromSource(sourceIndex); qDebug() << "BEGIN mapFromSource(" << sourceIndex << ")"; // QModelIndex parent = sourceIndex.parent(); Loading @@ -26,6 +27,11 @@ namespace Isis { // return m_root; // } // check if the model index corresponds to the invisible root item in source model if (sourceIndex == static_cast<QStandardItemModel *>(sourceModel())->invisibleRootItem()->index()) { return createIndex(sourceIndex.row(), 0, sourceIndex.internalId()); } // First check to see if the source index is the proxy root if (sourceIndex == m_root) { qDebug() << "source exactly matches root already."; Loading Loading @@ -88,13 +94,13 @@ namespace Isis { } QModelIndex ObservationSolveSettingsProxyModel::mapToSource(const QModelIndex &proxyIndex) const { QModelIndex SubTreeProxyModel::mapToSource(const QModelIndex &proxyIndex) const { // return proxyIndex; return QIdentityProxyModel::mapToSource(proxyIndex); } void ObservationSolveSettingsProxyModel::setSourceModel(QAbstractItemModel *newSourceModel) { void SubTreeProxyModel::setSourceModel(QAbstractItemModel *newSourceModel) { // QVariant data = newSourceModel->data(newSourceModel->index(0,0,QModelIndex())); // qDebug() << data; // qDebug() << "can convert to project item: " << data.canConvert<ProjectItem *>(); Loading Loading @@ -125,7 +131,7 @@ namespace Isis { } bool ObservationSolveSettingsProxyModel::setRoot(const QStandardItem *item) { bool SubTreeProxyModel::setRoot(const QStandardItem *item) { qDebug() << "setRoot() item->index() " << item->index(); qDebug() << "\titem->parent()->index() " << item->parent()->index(); m_root = QPersistentModelIndex(item->index()); Loading
isis/src/qisis/objs/SubTreeProxyModel/SubTreeProxyModel.h +3 −3 Original line number Diff line number Diff line Loading @@ -12,11 +12,11 @@ class QVariant; namespace Isis { class ObservationSolveSettingsProxyModel : public QIdentityProxyModel { class SubTreeProxyModel : public QIdentityProxyModel { Q_OBJECT public: explicit ObservationSolveSettingsProxyModel(QObject *parent = 0); explicit SubTreeProxyModel(QObject *parent = 0); QModelIndex mapFromSource(const QModelIndex &sourceIndex) const Q_DECL_OVERRIDE; QModelIndex mapToSource(const QModelIndex &proxyIndex) const Q_DECL_OVERRIDE; Loading