summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2017-12-21 11:38:49 (GMT)
committerKai Uwe Broulik <kde@privat.broulik.de>2017-12-21 11:38:49 (GMT)
commit89ff18ae5f05b41594deae240950e3eb81db75fe (patch)
tree9781102a2735e96ade88b3fbd39ecd8b3dd9c8a3
parent0b0a78e12872f35b7741ff64eadbeb96f6ce18f0 (diff)
Support high-dpi scaling in PackageDelegateHEADmaster
Ensures text isn't rendered blurry. BUG: 354050 Differential Revision: https://phabricator.kde.org/D9309
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/PackageModel/PackageDelegate.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4743018..5c52eb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
-find_package(Qt5 5.2.0 REQUIRED CONFIG COMPONENTS Widgets Concurrent)
+find_package(Qt5 5.6.0 REQUIRED CONFIG COMPONENTS Widgets Concurrent)
include(KDEInstallDirs)
include(KDECMakeSettings NO_POLICY_SCOPE)
include(KDECompilerSettings NO_POLICY_SCOPE)
diff --git a/src/PackageModel/PackageDelegate.cpp b/src/PackageModel/PackageDelegate.cpp
index e887fa4..da74b11 100644
--- a/src/PackageModel/PackageDelegate.cpp
+++ b/src/PackageModel/PackageDelegate.cpp
@@ -84,8 +84,11 @@ void PackageDelegate::paintPackageName(QPainter *painter, const QStyleOptionView
QColor foregroundColor = (option.state.testFlag(QStyle::State_Selected)) ?
option.palette.color(QPalette::HighlightedText) : option.palette.color(QPalette::Text);
+ const qreal dpr = painter->device()->devicePixelRatioF();
+
// Pixmap that the text/icon goes in
- QPixmap pixmap(option.rect.size());
+ QPixmap pixmap(option.rect.size() * dpr);
+ pixmap.setDevicePixelRatio(dpr);
pixmap.fill(Qt::transparent);
QPainter p(&pixmap);
p.translate(-option.rect.topLeft());