diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-17 12:55:12 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-17 12:57:46 (GMT) |
commit | 7c815bc2d4ea922d75f49f7dc29c81362ce5210e (patch) | |
tree | c070791f22c51eac1fe45b8a916e41fd9af17b12 /src | |
parent | cd8ff7d5879c3f2a9738c6416aced6d2efb7d9d9 (diff) | |
download | Qt-7c815bc2d4ea922d75f49f7dc29c81362ce5210e.zip Qt-7c815bc2d4ea922d75f49f7dc29c81362ce5210e.tar.gz Qt-7c815bc2d4ea922d75f49f7dc29c81362ce5210e.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/dialogs/qfontdialog_mac.mm | 8 |
1 files 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 |