Handle device pixel ratio in QIconLoaderEngine::paint()
QIcon::paint() paints blurry icons on HighDPI screens. In particular, it is called by QCommonStyle to paint icons for CE_ItemViewItem's. Change-Id: Iffe6bd01a8756e617656195ef63fe13c968e0832 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
f48a76bbbf
commit
b0145f029c
@ -629,7 +629,10 @@ void QIconLoaderEngine::ensureLoaded()
|
||||
void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
|
||||
QIcon::Mode mode, QIcon::State state)
|
||||
{
|
||||
QSize pixmapSize = rect.size();
|
||||
const qreal dpr = !qApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ?
|
||||
qreal(1.0) : painter->device()->devicePixelRatioF();
|
||||
|
||||
QSize pixmapSize = rect.size() * dpr;
|
||||
painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user