diff --git a/src/GUI/colorbox.cpp b/src/GUI/colorbox.cpp index 8e5f01e3..6c4d7f1a 100644 --- a/src/GUI/colorbox.cpp +++ b/src/GUI/colorbox.cpp @@ -35,15 +35,16 @@ void ColorBox::paintEvent(QPaintEvent *event) QStyleOptionComboBox option; option.initFrom(this); + // Fallback for styles that do not draw the background + painter.setBrush(_color); + painter.setPen(Qt::NoPen); + painter.drawRect(event->rect().adjusted(2, 2, -2, -2)); + + // If works, overpaints the previous rectangle #if defined(Q_OS_MAC) || defined(Q_OS_WIN32) painter.setBrush(_color); painter.drawPrimitive(QStyle::PE_Frame, option); #else // Q_OS_MAC || Q_OS_WIN32 - // Fallback for some broken QT4 styles that do not draw the background - painter.setBrush(_color); - painter.setPen(Qt::NoPen); - painter.drawRect(event->rect().adjusted(2, 2, -2, -2)); - // If works (QT5 and most QT4 styles) overpaints the previous rectangle option.palette.setBrush(QPalette::Base, _color); painter.drawPrimitive(QStyle::PE_PanelLineEdit, option); painter.drawPrimitive(QStyle::PE_FrameLineEdit, option);