Commit 0659559a authored by Kai Koehne's avatar Kai Koehne

CppEditor: Select also non-root items in the combo box

Temporarily setting setRootModelIndex allows us to do so.
parent 97444004
......@@ -1115,16 +1115,20 @@ void CPPEditor::updateOutlineIndexNow()
m_updateOutlineIndexTimer->stop();
m_outlineModelIndex = QModelIndex(); //invalidate
// ComboBox only let's you select top level indexes!
QModelIndex comboIndex = outlineModelIndex();
while (comboIndex.parent().isValid())
comboIndex = comboIndex.parent();
if (comboIndex.isValid()) {
bool blocked = m_outlineCombo->blockSignals(true);
// There is no direct way to select a non-root item
m_outlineCombo->setRootModelIndex(m_proxyModel->mapFromSource(comboIndex.parent()));
m_outlineCombo->setCurrentIndex(m_proxyModel->mapFromSource(comboIndex).row());
m_outlineCombo->setRootModelIndex(QModelIndex());
updateOutlineToolTip();
(void) m_outlineCombo->blockSignals(blocked);
m_outlineCombo->blockSignals(blocked);
}
}
......
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