From a210e6fef094dcc1b63e41d322cf64b427a9299c Mon Sep 17 00:00:00 2001 From: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com> Date: Fri, 1 Jul 2022 14:32:04 +0200 Subject: [PATCH] fix: set devicePixelRatio on pixmap (#106) --- src/providers/seventv/paints/Paint.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/providers/seventv/paints/Paint.cpp b/src/providers/seventv/paints/Paint.cpp index 17d9ac0d659..8b3598dc881 100644 --- a/src/providers/seventv/paints/Paint.cpp +++ b/src/providers/seventv/paints/Paint.cpp @@ -47,14 +47,19 @@ QPixmap Paint::getPixmap(const QString text, const QFont font, if (!shadow.isValid()) continue; - auto scaledShadow = shadow.scaled(scale); - // HACK: create a QLabel from the pixmap to apply drop shadows QLabel *label = new QLabel(); + + auto scaledShadow = shadow.scaled(scale / label->devicePixelRatioF()); + + // NOTE: avoid scaling issues on high DPI displays + pixmap.setDevicePixelRatio(label->devicePixelRatioF()); + label->setPixmap(pixmap); label->setGraphicsEffect(scaledShadow.getGraphicsEffect()); pixmap = label->grab(); + pixmap.setDevicePixelRatio(1); } if (drawColon)