diff --git a/ground/openpilotgcs/src/plugins/coreplugin/manhattanstyle.cpp b/ground/openpilotgcs/src/plugins/coreplugin/manhattanstyle.cpp index 4b00525c4..a1991ddc8 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/manhattanstyle.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/manhattanstyle.cpp @@ -55,6 +55,7 @@ #include #include #include +#include // We define a currently unused state for indicating animations #define State_Animating 0x00000040 @@ -217,7 +218,29 @@ QRect ManhattanStyle::subControlRect(ComplexControl control, const QStyleOptionC SubControl subControl, const QWidget *widget) const { QRect rect; - rect = d->style->subControlRect(control, option, subControl, widget); + // Need to check for Mac style and use the default behaviour for that + if(control == CC_ComboBox && subControl == SC_ComboBoxListBoxPopup) + { + const QStyleOptionComboBox *cb = qstyleoption_cast(option); + const QComboBox* combo = qobject_cast(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); + } return rect; }