Skip to content

Commit 03efbac

Browse files
authored
Migrate away from deprecated iconForFileType
Currently `iconForFileType` is used on macOS to display the file icons in the content tab. However this is marked as deprecated and should be replaced with `iconForContentType`. Related #15630. PR #22992.
1 parent 1c33fef commit 03efbac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/gui/macutilities.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "macutilities.h"
3030

3131
#import <Cocoa/Cocoa.h>
32+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
3233
#include <objc/message.h>
3334

3435
#include <QPixmap>
@@ -45,7 +46,8 @@ QPixmap pixmapForExtension(const QString &ext, const QSize &size)
4546
{
4647
@autoreleasepool
4748
{
48-
NSImage *image = [[NSWorkspace sharedWorkspace] iconForFileType:ext.toNSString()];
49+
const NSImage *image = [[NSWorkspace sharedWorkspace]
50+
iconForContentType:[UTType typeWithFilenameExtension:ext.toNSString()]];
4951
if (image)
5052
{
5153
NSRect rect = NSMakeRect(0, 0, size.width(), size.height());

0 commit comments

Comments
 (0)