Commit 8daa208f authored by Eike Ziller's avatar Eike Ziller Committed by Kai Koehne
Browse files

Handle mouse wheel on cpp editor's overview combo box



Mind that the mouse wheel doesn't really work on the combo box as
expected, because it only cycles through toplevel items.

Task-number: QTCREATORBUG-7894
Change-Id: I6e22b6c7d7256c16c81280e80652cf1350166f83
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent ac072e4c
......@@ -903,10 +903,22 @@ void CPPEditorWidget::onContentsChanged(int position, int charsRemoved, int char
void CPPEditorWidget::updateFileName()
{}
void CPPEditorWidget::jumpToOutlineElement(int)
{
QModelIndex index = m_proxyModel->mapToSource(m_outlineCombo->view()->currentIndex());
Symbol *symbol = m_outlineModel->symbolFromIndex(index);
void CPPEditorWidget::jumpToOutlineElement(int index)
{
QModelIndex modelIndex = m_outlineCombo->view()->currentIndex();
// When the user clicks on an item in the combo box,
// the view's currentIndex is updated, so we want to use that.
// When the scroll wheel was used on the combo box,
// the view's currentIndex is not updated,
// but the passed index to this method is correct.
// So, if the view has a current index, we reset it, to be able
// to distinguish wheel events later
if (modelIndex.isValid())
m_outlineCombo->view()->setCurrentIndex(QModelIndex());
else
modelIndex = m_proxyModel->index(index, 0); // toplevel index
QModelIndex sourceIndex = m_proxyModel->mapToSource(modelIndex);
Symbol *symbol = m_outlineModel->symbolFromIndex(sourceIndex);
if (! symbol)
return;
......
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