Set minimum height of workbench switcher to show all items when possible
This commit is contained in:
parent
4da08fc48d
commit
605d567cc4
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user