Set minimum height of workbench switcher to show all items when possible

This commit is contained in:
wmayer 2012-04-07 18:11:24 +02:00
parent 4da08fc48d
commit 605d567cc4
2 changed files with 14 additions and 0 deletions

View File

@ -28,6 +28,7 @@
# include <boost/bind.hpp>
# include <QActionEvent>
# include <QApplication>
# include <QDesktopWidget>
# include <QEvent>
# include <QMessageBox>
# include <QToolBar>
@ -345,6 +346,18 @@ WorkbenchComboBox::~WorkbenchComboBox()
{
}
void WorkbenchComboBox::showPopup()
{
int rows = count();
if (rows > 0) {
int height = view()->sizeHintForRow(0);
int maxHeight = QApplication::desktop()->height();
view()->setMinimumHeight(qMin(height * rows, maxHeight/2));
}
QComboBox::showPopup();
}
void WorkbenchComboBox::actionEvent ( QActionEvent* e )
{
QAction *action = e->action();

View File

@ -124,6 +124,7 @@ class GuiExport WorkbenchComboBox : public QComboBox
public:
WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=0);
virtual ~WorkbenchComboBox();
void showPopup();
public Q_SLOTS:
void onActivated(int);