[calamares] Remove unused method from progresstreemodel
This commit is contained in:
parent
7ec6dff352
commit
5a59eb1963
@ -175,53 +175,3 @@ ProgressTreeModel::setupModelData()
|
|||||||
m_rootItem->appendChild( new ViewStepItem( step, m_rootItem ) );
|
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;
|
|
||||||
}
|
|
||||||
|
@ -52,7 +52,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setupModelData();
|
void setupModelData();
|
||||||
QModelIndex indexFromItem( ProgressTreeItem* item );
|
|
||||||
|
|
||||||
ProgressTreeRoot* m_rootItem;
|
ProgressTreeRoot* m_rootItem;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user