Commit b9bbf246 authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo

C++ editor: Restrict outline combo popup width

Use Creator's main window as a reference for the width. Note that
this does not necessarily imply they are aligned.

Task-number: QTCREATORBUG-4021
Change-Id: Id0be8a7435d9b3f9eaab638f7a82bb0bd1afa192
Reviewed-on: http://codereview.qt.nokia.com/109Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@nokia.com>
parent c3a9436c
......@@ -105,6 +105,7 @@
#include <QtGui/QToolBar>
#include <QtGui/QTreeView>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QMainWindow>
#include <sstream>
......@@ -160,7 +161,26 @@ public:
void sync()
{
expandAll();
setMinimumWidth(qMax(sizeHintForColumn(0), minimumSizeHint().width()));
}
void adjustWidth()
{
const int w = Core::ICore::instance()->mainWindow()->geometry().width();
setMaximumWidth(w);
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), w));
}
};
class OverviewCombo : public QComboBox
{
public:
OverviewCombo(QWidget *parent = 0) : QComboBox(parent)
{}
void showPopup()
{
static_cast<OverviewTreeView *>(view())->adjustWidth();
QComboBox::showPopup();
}
};
......@@ -467,7 +487,7 @@ TextEditor::BaseTextEditor *CPPEditorWidget::createEditor()
void CPPEditorWidget::createToolBar(CPPEditor *editor)
{
m_outlineCombo = new QComboBox;
m_outlineCombo = new OverviewCombo;
m_outlineCombo->setMinimumContentsLength(22);
// Make the combo box prefer to expand
......
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