mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Merge remote-tracking branch 'origin/dwillis/gcs_gui_fixes' into next
This commit is contained in:
commit
3e4a33169c
@ -55,6 +55,7 @@
|
|||||||
#include <QtGui/QStyleOption>
|
#include <QtGui/QStyleOption>
|
||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
#include <QtGui/QAbstractItemView>
|
||||||
|
|
||||||
// We define a currently unused state for indicating animations
|
// We define a currently unused state for indicating animations
|
||||||
#define State_Animating 0x00000040
|
#define State_Animating 0x00000040
|
||||||
@ -217,7 +218,35 @@ QRect ManhattanStyle::subControlRect(ComplexControl control, const QStyleOptionC
|
|||||||
SubControl subControl, const QWidget *widget) const
|
SubControl subControl, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
QRect rect;
|
QRect rect;
|
||||||
|
#ifndef Q_WS_MACX
|
||||||
|
// Not using OSX, size combo dropdown to fit contents
|
||||||
|
if(control == CC_ComboBox && subControl == SC_ComboBoxListBoxPopup)
|
||||||
|
{
|
||||||
|
const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option);
|
||||||
|
const QComboBox* combo = qobject_cast<const QComboBox*>(widget);
|
||||||
|
QRect comboRect = cb->rect;
|
||||||
|
int newWidth = combo->view()->sizeHintForColumn(0);
|
||||||
|
if(newWidth > comboRect.width())
|
||||||
|
{
|
||||||
|
// Set new rectangle, only width matters, list height is set by
|
||||||
|
// combination of number of combo box items and setMaxVisibleItems
|
||||||
|
rect.setRect(comboRect.x(), comboRect.y(), newWidth, comboRect.height());
|
||||||
|
rect = visualRect(cb->direction, cb->rect, rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = d->style->subControlRect(control, option, subControl, widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = d->style->subControlRect(control, option, subControl, widget);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// Using OSX, use default style behaviour as this already sizes the
|
||||||
|
// combo dropdown to fit
|
||||||
rect = d->style->subControlRect(control, option, subControl, widget);
|
rect = d->style->subControlRect(control, option, subControl, widget);
|
||||||
|
#endif
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user