fix: compat for older Qt (lower than 5.13)
This commit is contained in:
parent
b146150528
commit
552d0fe072
|
@ -9,6 +9,13 @@
|
|||
#include <QImageReader>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
// TODO: remove this once we drop older Qt support.
|
||||
#if QT_VERSION_CHECK(5, 13, 0)
|
||||
#define COMPAT_CONSTCOLOR constexpr
|
||||
#else
|
||||
#define COMPAT_CONSTCOLOR const
|
||||
#endif
|
||||
|
||||
GraphicsView::GraphicsView(QWidget *parent)
|
||||
: QGraphicsView (parent)
|
||||
{
|
||||
|
@ -303,8 +310,8 @@ void GraphicsView::setCheckerboardEnabled(bool enabled, bool invertColor)
|
|||
QPixmap tilePixmap(0x20, 0x20);
|
||||
tilePixmap.fill(invertColor ? QColor(220, 220, 220, 170) : QColor(35, 35, 35, 170));
|
||||
QPainter tilePainter(&tilePixmap);
|
||||
constexpr QColor color(45, 45, 45, 170);
|
||||
constexpr QColor invertedColor(210, 210, 210, 170);
|
||||
COMPAT_CONSTCOLOR QColor color(45, 45, 45, 170);
|
||||
COMPAT_CONSTCOLOR QColor invertedColor(210, 210, 210, 170);
|
||||
tilePainter.fillRect(0, 0, 0x10, 0x10, invertColor ? invertedColor : color);
|
||||
tilePainter.fillRect(0x10, 0x10, 0x10, 0x10, invertColor ? invertedColor : color);
|
||||
tilePainter.end();
|
||||
|
|
Loading…
Reference in New Issue
Block a user