Skip to content
Snippets Groups Projects
Commit 7c365061 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlOutline: Ensure that element is always selected

Select parent element if the property isn't shown in outline (due to
filter).
parent b0bc76ec
No related branches found
No related tags found
No related merge requests found
......@@ -145,8 +145,16 @@ void QmlJSOutlineWidget::updateSelectionInTree(const QModelIndex &index)
return;
m_blockCursorSync = true;
m_treeView->selectionModel()->select(m_filterModel->mapFromSource(index), QItemSelectionModel::ClearAndSelect);
m_treeView->scrollTo(m_filterModel->mapFromSource(index));
QModelIndex baseIndex = index;
QModelIndex filterIndex = m_filterModel->mapFromSource(baseIndex);
while (baseIndex.isValid() && !filterIndex.isValid()) { // Search for ancestor index actually shown
baseIndex = baseIndex.parent();
filterIndex = m_filterModel->mapFromSource(baseIndex);
}
m_treeView->selectionModel()->select(filterIndex, QItemSelectionModel::ClearAndSelect);
m_treeView->scrollTo(filterIndex);
m_blockCursorSync = false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment