diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-06-28 09:32:09 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-07-12 13:24:56 +0200 |
commit | c78ec505293ed576779c0ee7342746cde39281d6 (patch) | |
tree | d10db3317a6cfbbd63e7f4d8f2e315050cf10c3c /src/widgets/styles/qstylepainter.h | |
parent | 9e453dacc3855bafd3d7b692d76699c3bf07b9c6 (diff) |
Improve widget painting under dpr>1 by enabling smooth pixmap scaling
Smooth scaling of icons etc. give far better visual results,
particularly with fractional dpr scaling. So enable this generally in
QStylePainter, and make more of the relevant widgets use QStylePainter
instead of QPainter directly.
Differences can be seen in the widgets examples, e.g. textedit,
gallery, stylesheet (Pagefold), mdi.
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-96223
Fixes: QTBUG-101058
Change-Id: I3c34a455d097e5f6a6a09d3b020528b4fbda4d85
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/styles/qstylepainter.h')
-rw-r--r-- | src/widgets/styles/qstylepainter.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h index 8243ff5f39..65664b776e 100644 --- a/src/widgets/styles/qstylepainter.h +++ b/src/widgets/styles/qstylepainter.h @@ -23,7 +23,9 @@ public: Q_ASSERT_X(w, "QStylePainter::QStylePainter", "Widget must be non-zero"); widget = w; wstyle = w->style(); - return QPainter::begin(pd); + const bool res = QPainter::begin(pd); + setRenderHint(QPainter::SmoothPixmapTransform); + return res; }; inline void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt); inline void drawControl(QStyle::ControlElement ce, const QStyleOption &opt); |