2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Closed beta 10019011: various style improvements.

This commit is contained in:
John Preston
2016-12-03 15:10:35 +03:00
parent 2796c53542
commit b0f14d1856
60 changed files with 441 additions and 313 deletions

View File

@@ -75,6 +75,40 @@ public:
void drawPixmapRight(const QPoint &p, int outerw, const QPixmap &pix) {
return drawPixmapRight(p.x(), p.y(), outerw, pix);
}
};
class PainterHighQualityEnabler {
public:
PainterHighQualityEnabler(Painter &p) : _painter(p) {
auto hints = _painter.renderHints();
for_const (auto hint, Hints) {
if (!(hints & hint)) {
_hints |= hint;
}
}
if (_hints) {
_painter.setRenderHints(_hints);
}
}
PainterHighQualityEnabler(const PainterHighQualityEnabler &other) = delete;
PainterHighQualityEnabler &operator=(const PainterHighQualityEnabler &other) = delete;
~PainterHighQualityEnabler() {
if (_hints) {
_painter.setRenderHints(_hints, false);
}
}
private:
Painter &_painter;
QPainter::RenderHints _hints = 0;
static constexpr QPainter::RenderHint Hints[] = {
QPainter::Antialiasing,
QPainter::SmoothPixmapTransform,
QPainter::TextAntialiasing,
QPainter::HighQualityAntialiasing
};
};
#define T_WIDGET \