summaryrefslogtreecommitdiff
path: root/dev-vcs/qgit/files/qgit-2.7-highdpi-support.patch
blob: 17f940aa23b747f4f4f202f18a1eb7c6732809d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From e60ae49271e06384163afa1ebd1e562eb7c520ed Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu, 15 Feb 2018 17:39:22 +0000
Subject: [PATCH] Add high DPI support

---
 src/listview.cpp | 11 ++++++++++-
 src/qgit.cpp     |  5 ++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/listview.cpp b/src/listview.cpp
index dd6a8cb..e4f094e 100644
--- a/src/listview.cpp
+++ b/src/listview.cpp
@@ -884,7 +884,16 @@ void ListViewDelegate::addTextPixmap(QPixmap** pp, SCRef txt, const QStyleOption
         int pw = fm.boundingRect(txt).width() + 2 * spacing;
         int ph = fm.height();
 
-	QPixmap* newPm = new QPixmap(ofs + pw, ph);
+    QSize pixmapSize(ofs + pw, ph);
+
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
+    qreal dpr = qApp->devicePixelRatio();
+	QPixmap* newPm = new QPixmap(pixmapSize * dpr);
+    newPm->setDevicePixelRatio(dpr);
+#else
+    QPixmap* newPm = new QPixmap(pixmapSize);
+#endif
+
 	QPainter p;
 	p.begin(newPm);
 	if (!pm->isNull()) {
diff --git a/src/qgit.cpp b/src/qgit.cpp
index 266a7b8..b01c49e 100644
--- a/src/qgit.cpp
+++ b/src/qgit.cpp
@@ -18,7 +18,10 @@ using namespace QGit;
 int main(int argc, char* argv[]) {
 
 	QApplication app(argc, argv);
-	QCoreApplication::setOrganizationName(ORG_KEY);
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0)
+    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
+#endif
+    QCoreApplication::setOrganizationName(ORG_KEY);
 	QCoreApplication::setApplicationName(APP_KEY);
 
 	/* On Windows msysgit exec directory is set up
-- 
2.15.1