You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-vcs/qgit/files/qgit-2.7-highdpi-support.patch

52 lines
1.5 KiB

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