CppEditor::OverViewTreeView: Don't depend on ICore::mainWindow()

Change-Id: Ic212807eda4a56f54fd5c8f37c5ab1645b74243f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Daniel Teske
2014-04-24 12:29:39 +02:00
parent 71fb8aa3b2
commit 13af3e9d1e

View File

@@ -39,7 +39,6 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/icore.h>
#include <cpptools/cpptoolseditorsupport.h>
#include <cpptools/cpptoolsplugin.h>
#include <cpptools/cpptoolsconstants.h>
@@ -112,11 +111,10 @@ public:
expandAll();
}
void adjustWidth()
void adjustWidth(int width)
{
const int w = Core::ICore::mainWindow()->geometry().width();
setMaximumWidth(w);
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), w));
setMaximumWidth(width);
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), width));
}
};
@@ -139,7 +137,7 @@ public:
void showPopup()
{
static_cast<OverviewTreeView *>(view())->adjustWidth();
static_cast<OverviewTreeView *>(view())->adjustWidth(topLevelWidget()->geometry().width());
QComboBox::showPopup();
}