Simplify PainterHighQualityEnabler code

There is no need to iterate over a list, flags can be applied and stored
simultaneously.
This commit is contained in:
Mayeul Cantan 2020-11-01 02:47:47 +01:00
parent 6219604ff8
commit 5f086cd93d
1 changed files with 3 additions and 11 deletions

View File

@ -139,18 +139,10 @@ public:
PainterHighQualityEnabler(Painter &p)
: _painter(p)
{
static constexpr QPainter::RenderHint Hints[] = {QPainter::Antialiasing,
QPainter::SmoothPixmapTransform,
QPainter::TextAntialiasing};
hints_ = QPainter::Antialiasing | QPainter::SmoothPixmapTransform |
QPainter::TextAntialiasing;
auto hints = _painter.renderHints();
for (const auto &hint : Hints) {
if (!(hints & hint))
hints_ |= hint;
}
if (hints_)
_painter.setRenderHints(hints_);
_painter.setRenderHints(hints_);
}
~PainterHighQualityEnabler()