summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2018-04-20 12:22:35 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2018-04-24 19:46:14 +0000
commitc7eb2c173e79f2936985cd7589347e59b6005c7c (patch)
treee646bece7030f964419850d6e4fb77b8cc9da064 /src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
parenta4e6117c53c3984585b3bbb74c00d6d863c98fcd (diff)
QCocoaFontDialogHelper: Fix NSFontManager delegate warning
According to Apple's documentation, there's no delegate in NSFontManager. We set its target instead. The action is changeFont: by default. Change-Id: I8c01bfa97c78dd8097f38c27353748d13f51489f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index 9a96895d07..815882ab06 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -73,8 +73,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
return newFont;
}
-@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate);
-
@interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject<NSWindowDelegate, QNSPanelDelegate>
{
@public
@@ -110,7 +108,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
[mFontPanel setRestorable:NO];
[mFontPanel setDelegate:self];
- [[NSFontManager sharedFontManager] setDelegate:self];
+
+ [NSFontManager sharedFontManager].target = self; // Action is changeFont:
[mFontPanel retain];
return self;
@@ -120,7 +119,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
{
[mStolenContentView release];
[mFontPanel setDelegate:nil];
- [[NSFontManager sharedFontManager] setDelegate:nil];
+ [NSFontManager sharedFontManager].target = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];