Fix missing icon on different resolutions
This commit is contained in:
parent
76afd51861
commit
72b84f523d
|
@ -447,7 +447,11 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
|
||||
// Set show icons in menus flag (use iconVisibleInMenu to disable selectively)
|
||||
QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus, false);
|
||||
bool dontShowIcon =
|
||||
!Preferences::instance()->isShowAdvancedOptionsEnabled() ||
|
||||
!Preferences::instance()->getBoolValue(showIconsInMenu);
|
||||
QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus,
|
||||
dontShowIcon);
|
||||
|
||||
TEnv::setApplicationFileName(argv[0]);
|
||||
|
||||
|
|
|
@ -568,11 +568,19 @@ QIcon createQIcon(const QString &iconSVGName, bool useFullOpacity,
|
|||
// there can be scaling artifacts with high dpi and load these in addition
|
||||
if (baseImg.width() == (16 * devPixRatio) &&
|
||||
baseImg.height() == (16 * devPixRatio)) {
|
||||
QSize expandSize(20, 20);
|
||||
QImage toolBaseImg(compositeImage(baseImg, expandSize));
|
||||
QImage toolOverImg(compositeImage(overImg, expandSize));
|
||||
QImage toolOnImg(compositeImage(onImg, expandSize));
|
||||
addImagesToIcon(icon, toolBaseImg, toolOverImg, toolOnImg, useFullOpacity);
|
||||
for (auto screen : QApplication::screens()) {
|
||||
QSize expandSize(20, 20);
|
||||
int otherDevPixRatio = screen->devicePixelRatio();
|
||||
if (otherDevPixRatio != devPixRatio) {
|
||||
expandSize.setWidth(16 * otherDevPixRatio);
|
||||
expandSize.setHeight(16 * otherDevPixRatio);
|
||||
}
|
||||
QImage toolBaseImg(compositeImage(baseImg, expandSize));
|
||||
QImage toolOverImg(compositeImage(overImg, expandSize));
|
||||
QImage toolOnImg(compositeImage(onImg, expandSize));
|
||||
addImagesToIcon(icon, toolBaseImg, toolOverImg, toolOnImg,
|
||||
useFullOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
|
Loading…
Reference in a new issue