Icons: Additionally add lower resolutions to QIcons in HighDPI mode

The lower resolution(s) are needed in setups where attached Displays
have different scale factors and Qt Creator is dragged to the lower
resolution screens.

Task-number: QTCREATORBUG-16128
Change-Id: I20a2e67e4ac5929f3cffc9d7b25e340257be0cee
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2016-04-21 12:38:26 +02:00
parent cba8763f55
commit 862fd345fe

View File

@@ -183,12 +183,15 @@ QIcon Icon::icon() const
return QIcon(combinedPlainPixmaps(*this));
} else {
QIcon result;
const MasksAndColors masks = masksAndColors(*this, qRound(qApp->devicePixelRatio()));
const QPixmap combinedMask = Utils::combinedMask(masks, m_style);
result.addPixmap(masksToIcon(masks, combinedMask, m_style));
const int maxDpr = qRound(qApp->devicePixelRatio());
for (int dpr = 1; dpr <= maxDpr; dpr++) {
const MasksAndColors masks = masksAndColors(*this, dpr);
const QPixmap combinedMask = Utils::combinedMask(masks, m_style);
result.addPixmap(masksToIcon(masks, combinedMask, m_style));
const QColor disabledColor = creatorTheme()->color(Theme::IconsDisabledColor);
result.addPixmap(maskToColorAndAlpha(combinedMask, disabledColor), QIcon::Disabled);
const QColor disabledColor = creatorTheme()->color(Theme::IconsDisabledColor);
result.addPixmap(maskToColorAndAlpha(combinedMask, disabledColor), QIcon::Disabled);
}
return result;
}
}