[calamares] Remove unused method from progresstreemodel

This commit is contained in:
Adriaan de Groot 2020-03-10 13:43:04 -05:00
parent 7ec6dff352
commit 5a59eb1963
2 changed files with 0 additions and 51 deletions

View File

@ -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;
}

View File

@ -52,7 +52,6 @@ public:
private:
void setupModelData();
QModelIndex indexFromItem( ProgressTreeItem* item );
ProgressTreeRoot* m_rootItem;
};