Widgets: pass dpr to QIcon::pixmap()
Replace the last occourences of QIcon::pixmap() which do not pass the current devicePixelRatio with the correct calls. Pick-to: 6.9 Change-Id: I440944f784a991a88a8c6bb42e4c79f112bab8f6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
83d964ea70
commit
78ae4177fa
@ -197,8 +197,11 @@ void QUrlModel::setUrl(const QModelIndex &index, const QUrl &url, const QModelIn
|
|||||||
// Make sure that we have at least 32x32 images
|
// Make sure that we have at least 32x32 images
|
||||||
const QSize size = newIcon.actualSize(QSize(32,32));
|
const QSize size = newIcon.actualSize(QSize(32,32));
|
||||||
if (size.width() < 32) {
|
if (size.width() < 32) {
|
||||||
QPixmap smallPixmap = newIcon.pixmap(QSize(32, 32));
|
const auto widget = qobject_cast<QWidget *>(parent());
|
||||||
newIcon.addPixmap(smallPixmap.scaledToWidth(32, Qt::SmoothTransformation));
|
const auto dpr = widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
|
||||||
|
const auto smallPixmap = newIcon.pixmap(QSize(32, 32), dpr);
|
||||||
|
const auto newPixmap = smallPixmap.scaledToWidth(32 * dpr, Qt::SmoothTransformation);
|
||||||
|
newIcon.addPixmap(newPixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
|
|||||||
|
|
||||||
const QPoint pos(origin.x() + iconLeft, origin.y() + verticalCenter - size / 2);
|
const QPoint pos(origin.x() + iconLeft, origin.y() + verticalCenter - size / 2);
|
||||||
const QPoint posDp = pos * QVistaHelper::m_devicePixelRatio;
|
const QPoint posDp = pos * QVistaHelper::m_devicePixelRatio;
|
||||||
const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(size * QVistaHelper::m_devicePixelRatio));
|
const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(QSize(size, size), QVistaHelper::m_devicePixelRatio));
|
||||||
DrawIconEx(hdc, posDp.x(), posDp.y(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
|
DrawIconEx(hdc, posDp.x(), posDp.y(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
|
||||||
DestroyIcon(hIcon);
|
DestroyIcon(hIcon);
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ void ControlLabel::updateWindowIcon()
|
|||||||
if (menuIcon.isNull())
|
if (menuIcon.isNull())
|
||||||
menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, parentWidget());
|
menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, nullptr, parentWidget());
|
||||||
const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, nullptr, parentWidget());
|
const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, nullptr, parentWidget());
|
||||||
label = menuIcon.pixmap(iconSize);
|
label = menuIcon.pixmap(QSize(iconSize, iconSize), devicePixelRatio());
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user