mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-08 16:24:28 +02:00
Fixed widget rendering issues
This commit is contained in:
@ -30,20 +30,20 @@ void ColorBox::paintEvent(QPaintEvent *event)
|
||||
QStylePainter painter(this);
|
||||
|
||||
QStyleOptionComboBox option;
|
||||
option.initFrom(this);
|
||||
option.initFrom(this);
|
||||
|
||||
#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
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
// Fallback for some broken QT4 styles that do not draw the background
|
||||
painter.setBrush(_color);
|
||||
painter.drawRect(event->rect().adjusted(-1, -1, 0, 0));
|
||||
painter.drawPrimitive(QStyle::PE_FrameLineEdit, option);
|
||||
#else // QT 5
|
||||
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);
|
||||
#endif // QT 5
|
||||
#endif // Q_OS_MAC || Q_OS_WIN32
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user