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.
This commit is contained in:
Ryu481 2025-07-20 10:47:26 -07:00 committed by GitHub
commit 03efbac581
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,6 +29,7 @@
#include "macutilities.h" #include "macutilities.h"
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#include <objc/message.h> #include <objc/message.h>
#include <QPixmap> #include <QPixmap>
@ -45,7 +46,8 @@ namespace MacUtils
{ {
@autoreleasepool @autoreleasepool
{ {
NSImage *image = [[NSWorkspace sharedWorkspace] iconForFileType:ext.toNSString()]; const NSImage *image = [[NSWorkspace sharedWorkspace]
iconForContentType:[UTType typeWithFilenameExtension:ext.toNSString()]];
if (image) if (image)
{ {
NSRect rect = NSMakeRect(0, 0, size.width(), size.height()); NSRect rect = NSMakeRect(0, 0, size.width(), size.height());