Document that QPlatformTheme::standardPixmap should always be a 1x pixmap
This reverts 59bbfb17db563d7e62b9f3158dab3cc6e7e68acd and c853054910552f5fef04797222dde0d29a0c340d, as that approach was causing issues for QCommonStyle::iconFromWindowsTheme, for example in situations where the system has a 1x and 2.5x screen, and the user requests a 16x16 pixmap or icon via QStyle::standardPixmap or QStyle::standardIcon. In that situation our smallest pixmap is 40x40, and we need to downscale, causing blurred results on a 1x screen. Change-Id: Ifa6e15d37d15954df689253c32eaa779885c567b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit d884abaf8bdc1be74ee52306948c0be1986d738d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
eab71ff6b0
commit
78051d03ca
@ -470,9 +470,16 @@ const QFont *QPlatformTheme::font(Font type) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
|
||||
/*!
|
||||
\brief Return a pixmap for \a standardPixmap, at the given \a size.
|
||||
|
||||
The implementation should not take system DPR into account, and
|
||||
always return a pixmap with a DPR of 1. It's up to the consumer
|
||||
to account for DPR and request a pixmap of the right size.
|
||||
*/
|
||||
QPixmap QPlatformTheme::standardPixmap(StandardPixmap standardPixmap, const QSizeF &size) const
|
||||
{
|
||||
Q_UNUSED(sp);
|
||||
Q_UNUSED(standardPixmap);
|
||||
Q_UNUSED(size);
|
||||
// TODO Should return QCommonStyle pixmaps?
|
||||
return QPixmap();
|
||||
|
@ -390,9 +390,7 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
|
||||
QT_IGNORE_DEPRECATIONS(GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon));
|
||||
|
||||
if (icon) {
|
||||
const auto dpr = qGuiApp->devicePixelRatio(); // Highest in the system
|
||||
pixmap = qt_mac_convert_iconref(icon, size.width() * dpr, size.height() * dpr);
|
||||
pixmap.setDevicePixelRatio(dpr);
|
||||
pixmap = qt_mac_convert_iconref(icon, size.width(), size.height());
|
||||
QT_IGNORE_DEPRECATIONS(ReleaseIconRef(icon));
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,8 @@ public:
|
||||
case Theme:
|
||||
if (row >= themedIcons.size())
|
||||
break;
|
||||
return QIcon(QApplicationPrivate::platformTheme()->standardPixmap(QPlatformTheme::StandardPixmap(row), {64, 64}));
|
||||
return QIcon(QApplicationPrivate::platformTheme()->standardPixmap(
|
||||
QPlatformTheme::StandardPixmap(row), QSize(64, 64) * qGuiApp->devicePixelRatio()));
|
||||
case Icon:
|
||||
if (row < themedIcons.size())
|
||||
return QIcon::fromTheme(themedIcons.at(row));
|
||||
|
Loading…
x
Reference in New Issue
Block a user