mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
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:
parent
1c33fefc6d
commit
03efbac581
1 changed files with 3 additions and 1 deletions
|
@ -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());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue