Skip to content

Commit

Permalink
Add high DPI support
Browse files Browse the repository at this point in the history
  • Loading branch information
davidedmundson authored and tibirna committed May 21, 2018
1 parent 3624d85 commit c219a0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/listview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
5 changes: 4 additions & 1 deletion src/qgit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c219a0e

Please sign in to comment.