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
...@@ -145,8 +145,16 @@ void QmlJSOutlineWidget::updateSelectionInTree(const QModelIndex &index) ...@@ -145,8 +145,16 @@ void QmlJSOutlineWidget::updateSelectionInTree(const QModelIndex &index)
return; return;
m_blockCursorSync = true; 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; m_blockCursorSync = false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment