Add support for HiDPI cursors

--HG--
branch : feature
This commit is contained in:
Benjamin Nauck 2016-01-02 15:52:42 +01:00
parent 8be71c1ecb
commit 1be3c90cd3

View File

@ -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);