forked from qt-creator/qt-creator
TreeModel: Introduce a TreeItem::indexInParent() convenience function
To shorten user code and hide the ugly const_cast. Change-Id: I798bd105932004ea17cb95b243fc38ccfcda0a2c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -361,7 +361,7 @@ void ProjectWindow::deregisterProject(Project *project)
|
||||
void ProjectWindow::startupProjectChanged(Project *project)
|
||||
{
|
||||
if (ProjectItem *projectItem = itemForProject(project)) {
|
||||
int index = projectItem->parent()->children().indexOf(projectItem);
|
||||
int index = projectItem->indexInParent();
|
||||
QTC_ASSERT(index != -1, return);
|
||||
m_projectSelection->setCurrentIndex(index);
|
||||
m_selectorModel->rootItem()->m_currentProjectIndex = index;
|
||||
|
||||
Reference in New Issue
Block a user