mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Draw at least the color rectangle under the Qt 6.7.1 windows style
This commit is contained in:
parent
73fa197c25
commit
332abd53ae
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user