Save temp icon in higher resolution on HiDPI screens

In case temporary system tray icon is saved to /tmp, scale it according
to current devicePixelRatio() instead of using hardcoded 22x22.

Change-Id: I2adf2151da3241f4600f8645e323346daabcec4b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
bb10
Victor Kropp 2016-08-04 16:42:46 +02:00 committed by Shawn Rutledge
parent 7a593c8c98
commit 0dedb60385
1 changed files with 2 additions and 1 deletions

View File

@ -161,9 +161,10 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
} }
if (!necessary) if (!necessary)
return Q_NULLPTR; return Q_NULLPTR;
qreal dpr = qGuiApp->devicePixelRatio();
QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this); QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this);
ret->open(); ret->open();
icon.pixmap(QSize(22, 22)).save(ret); icon.pixmap(QSize(22 * dpr, 22 * dpr)).save(ret);
ret->close(); ret->close();
return ret; return ret;
} }