From 0659559a62dee357a26857c8d473b58ba22946e6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 13 Jul 2010 11:44:05 +0200 Subject: [PATCH] CppEditor: Select also non-root items in the combo box Temporarily setting setRootModelIndex allows us to do so. --- src/plugins/cppeditor/cppeditor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 85845070838..c2d42cfc6fb 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -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); } }