From 7c815bc2d4ea922d75f49f7dc29c81362ce5210e Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Fri, 17 Apr 2009 14:55:12 +0200 Subject: BT: Make native QFontDialog work when using show and changing windows Cocoa's font manager uses "first responder" which is a great idea, but breaks as soon as we change windows. Thankfully we can just set the target and we are OK. An upshot is that we don't need the delegate, but I'm not going to push my luck on that. Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfontdialog_mac.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index d6ddfa3..42be3be 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -190,7 +190,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin newFont.setStrikeOut(mQtFont->strikeOut()); } - [self setQtFont:newFont]; + [self setQtFont:newFont]; if (mPriv) mPriv->updateSampleFont(*mQtFont); } @@ -357,8 +357,8 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin - (void)setQtFont:(const QFont &)newFont { - delete mQtFont; - mQtFont = new QFont(newFont); + delete mQtFont; + mQtFont = new QFont(newFont); } - (QFont)qtFont @@ -404,6 +404,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin } [mFontPanel setDelegate:nil]; [[NSFontManager sharedFontManager] setDelegate:nil]; + [[NSFontManager sharedFontManager] setTarget:nil]; } @end @@ -527,6 +528,7 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial, extraHeight:dialogExtraHeight]; [ourPanel setDelegate:delegate]; [[NSFontManager sharedFontManager] setDelegate:delegate]; + [[NSFontManager sharedFontManager] setTarget:delegate]; setFont(delegate, initial); // hack to get correct initial layout -- cgit v0.12