Commit 42a885fc authored by Francois Ferrand's avatar Francois Ferrand Committed by Leandro Melo

Allow expanding items in the overview combobox.

This makes navigation through large files much easier.

Change-Id: Ie55f75078a1727949db6e8824af4795deb96292e
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent c4da217c
......@@ -160,14 +160,36 @@ public:
class OverviewCombo : public QComboBox
{
public:
OverviewCombo(QWidget *parent = 0) : QComboBox(parent)
OverviewCombo(QWidget *parent = 0) : QComboBox(parent), m_skipNextHide(false)
{}
bool eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::MouseButtonPress && object == view()->viewport()) {
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QModelIndex index = view()->indexAt(mouseEvent->pos());
if (!view()->visualRect(index).contains(mouseEvent->pos()))
m_skipNextHide = true;
}
return false;
}
void showPopup()
{
static_cast<OverviewTreeView *>(view())->adjustWidth();
QComboBox::showPopup();
}
virtual void hidePopup()
{
if (m_skipNextHide)
m_skipNextHide = false;
else
QComboBox::hidePopup();
}
private:
bool m_skipNextHide;
};
class OverviewProxyModel : public QSortFilterProxyModel
......@@ -504,9 +526,10 @@ void CPPEditorWidget::createToolBar(CPPEditor *editor)
QTreeView *outlineView = new OverviewTreeView;
outlineView->header()->hide();
outlineView->setItemsExpandable(false);
outlineView->setItemsExpandable(true);
m_outlineCombo->setView(outlineView);
m_outlineCombo->setMaxVisibleItems(40);
outlineView->viewport()->installEventFilter(m_outlineCombo);
m_outlineModel = new OverviewModel(this);
m_proxyModel = new OverviewProxyModel(m_outlineModel, this);
......
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