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

Temporarily setting setRootModelIndex allows us to do so.
This commit is contained in:
Kai Koehne
2010-07-13 11:44:05 +02:00
parent 97444004ec
commit 0659559a62

View File

@@ -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);
}
}