macOS: Restore fallback sizes when setting application or window icons
We removed this logic in 059c3ae66a
under the assumption that the icon
would always provide a set of sizes, but for SVG icons this is not
the case.
Change-Id: Ib3cc5740bca32cf4068a71baf99b52fa536da2ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
164110f7bb
commit
86f228b819
@ -472,7 +472,9 @@ QList<QCocoaWindow *> *QCocoaIntegration::popupWindowStack()
|
||||
|
||||
void QCocoaIntegration::setApplicationIcon(const QIcon &icon) const
|
||||
{
|
||||
NSApp.applicationIconImage = [NSImage imageFromQIcon:icon];
|
||||
// Fall back to a size that looks good on the highest resolution screen available
|
||||
auto fallbackSize = NSApp.dockTile.size.width * qGuiApp->devicePixelRatio();
|
||||
NSApp.applicationIconImage = [NSImage imageFromQIcon:icon withSize:fallbackSize];
|
||||
}
|
||||
|
||||
void QCocoaIntegration::beep() const
|
||||
|
@ -904,10 +904,13 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon)
|
||||
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
if (icon.isNull())
|
||||
if (icon.isNull()) {
|
||||
iconButton.image = [NSWorkspace.sharedWorkspace iconForFile:m_view.window.representedFilename];
|
||||
else
|
||||
iconButton.image = [NSImage imageFromQIcon:icon];
|
||||
} else {
|
||||
// Fall back to a size that looks good on the highest resolution screen available
|
||||
auto fallbackSize = iconButton.frame.size.height * qGuiApp->devicePixelRatio();
|
||||
iconButton.image = [NSImage imageFromQIcon:icon withSize:fallbackSize];
|
||||
}
|
||||
}
|
||||
|
||||
void QCocoaWindow::setAlertState(bool enabled)
|
||||
|
Loading…
Reference in New Issue
Block a user