diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2017-09-12 18:55:14 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2017-09-19 13:54:30 +0000 |
commit | 5e89fae10f95a83d5fd098e39523dee71c9c6b84 (patch) | |
tree | b876b48acb5e98c9d8e68c008cfcfc807fc03495 /src/plugins/projectexplorer/miniprojecttargetselector.cpp | |
parent | be376ae7060e547c6dc9092e7e77dde6e9e6570f (diff) | |
download | qt-creator-5e89fae10f95a83d5fd098e39523dee71c9c6b84.tar.gz |
Unify the dimensions for all mode/action bar icons
Having icons of all different kinds of sizes makes it difficult to get
the painting right in all cases. It definitely fails when the szsytem is
running in multi-monitor mode with different scaling factors. Unifying
the dimensions makes it possible.
This change should not cause any visual difference in a purely scaled or
unscaled screen.
Task-number: QTCREATORBUG-18869
Change-Id: I3a864c9a86036b4f4f3b350a489077b247ca85b7
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/miniprojecttargetselector.cpp')
-rw-r--r-- | src/plugins/projectexplorer/miniprojecttargetselector.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 03e10fe258..46b63e2393 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -65,21 +65,21 @@ static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay) { QPixmap targetPixmap; const qreal appDevicePixelRatio = qApp->devicePixelRatio(); - int deviceSpaceIconSize = Core::Constants::TARGET_ICON_SIZE * appDevicePixelRatio; - targetPixmap = QPixmap(deviceSpaceIconSize, deviceSpaceIconSize); + targetPixmap = QPixmap(Core::Constants::MODEBAR_ICON_SIZE * appDevicePixelRatio, + Core::Constants::MODEBAR_ICON_SIZE * appDevicePixelRatio); targetPixmap.setDevicePixelRatio(appDevicePixelRatio); targetPixmap.fill(Qt::transparent); QPainter painter(&targetPixmap); // painter in user space - QPixmap pixmap = icon.pixmap(Core::Constants::TARGET_ICON_SIZE); // already takes app devicePixelRatio into account + QPixmap pixmap = icon.pixmap(Core::Constants::MODEBAR_ICON_SIZE); // already takes app devicePixelRatio into account qreal pixmapDevicePixelRatio = pixmap.devicePixelRatio(); - painter.drawPixmap((Core::Constants::TARGET_ICON_SIZE - pixmap.width() / pixmapDevicePixelRatio) / 2, - (Core::Constants::TARGET_ICON_SIZE - pixmap.height() / pixmapDevicePixelRatio) / 2, pixmap); + painter.drawPixmap((Core::Constants::MODEBAR_ICON_SIZE - pixmap.width() / pixmapDevicePixelRatio) / 2, + (Core::Constants::MODEBAR_ICON_SIZE - pixmap.height() / pixmapDevicePixelRatio) / 2, pixmap); if (!overlay.isNull()) { - pixmap = overlay.pixmap(Core::Constants::TARGET_ICON_SIZE); // already takes app devicePixelRatio into account + pixmap = overlay.pixmap(Core::Constants::MODEBAR_ICON_SIZE); // already takes app devicePixelRatio into account pixmapDevicePixelRatio = pixmap.devicePixelRatio(); - painter.drawPixmap((Core::Constants::TARGET_ICON_SIZE - pixmap.width() / pixmapDevicePixelRatio) / 2, - (Core::Constants::TARGET_ICON_SIZE - pixmap.height() / pixmapDevicePixelRatio) / 2, pixmap); + painter.drawPixmap((Core::Constants::MODEBAR_ICON_SIZE - pixmap.width() / pixmapDevicePixelRatio) / 2, + (Core::Constants::MODEBAR_ICON_SIZE - pixmap.height() / pixmapDevicePixelRatio) / 2, pixmap); } return QIcon(targetPixmap); |