Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing icon on different resolutions #1196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion toonz/sources/toonz/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
18 changes: 13 additions & 5 deletions toonz/sources/toonzqt/gutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down