diff --git a/src/calamares/progresstree/ProgressTreeModel.cpp b/src/calamares/progresstree/ProgressTreeModel.cpp index d4b5a0321..3c0511e75 100644 --- a/src/calamares/progresstree/ProgressTreeModel.cpp +++ b/src/calamares/progresstree/ProgressTreeModel.cpp @@ -175,53 +175,3 @@ ProgressTreeModel::setupModelData() m_rootItem->appendChild( new ViewStepItem( step, m_rootItem ) ); } } - - -QModelIndex -ProgressTreeModel::indexFromItem( ProgressTreeItem* item ) -{ - if ( !item || !item->parent() ) - { - return QModelIndex(); - } - - // Reconstructs a QModelIndex from a ProgressTreeItem that is somewhere in the tree. - // Traverses the item to the root node, then rebuilds the qmodelindices from there - // back down; each int is the row of that item in the parent. - /** - * In this diagram, if the item is G, childIndexList will contain [0, 2, 0] - * - * A - * D - * E - * F - * G - * H - * B - * C - * - **/ - QList< int > childIndexList; - ProgressTreeItem* curItem = item; - while ( curItem != m_rootItem ) - { - int row = curItem->row(); //relative to its parent - if ( row < 0 ) // something went wrong, bail - { - return QModelIndex(); - } - - childIndexList << row; - - curItem = curItem->parent(); - } - - // Now we rebuild the QModelIndex we need - QModelIndex idx; - for ( int i = childIndexList.size() - 1; i >= 0; i-- ) - { - idx = index( childIndexList[ i ], 0, idx ); - } - - return idx; -} diff --git a/src/calamares/progresstree/ProgressTreeModel.h b/src/calamares/progresstree/ProgressTreeModel.h index e424f9d8d..1e3f8a49d 100644 --- a/src/calamares/progresstree/ProgressTreeModel.h +++ b/src/calamares/progresstree/ProgressTreeModel.h @@ -52,7 +52,6 @@ public: private: void setupModelData(); - QModelIndex indexFromItem( ProgressTreeItem* item ); ProgressTreeRoot* m_rootItem; };