From 1be3c90cd342a800b6bd9f268ad0fae32c5e4210 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Sat, 2 Jan 2016 15:52:42 +0100 Subject: [PATCH] Add support for HiDPI cursors --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 007b84b7c..3293236ae 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -560,7 +560,15 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur CancelTool(); emit EnableItemMove(false); currentTool = lastUsedTool = t; - QPixmap pixmap(cursor); + auto cursorResource = cursor; + if (qApp->devicePixelRatio() >= 2) { + // try to load HiDPI versions of the cursors if availible + auto cursorHidpiResource = QString(cursor).replace(".png", "@2x.png"); + if (QFileInfo(cursorResource).exists()) { + cursorResource = cursorHidpiResource; + } + } + QPixmap pixmap(cursorResource); QCursor cur(pixmap, 2, 3); ui->view->setCursor(cur); ui->view->setShowToolOptions(false);