summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-04-17 12:55:12 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-04-17 13:29:58 (GMT)
commitaa29f55547ce72ef6a87c34543face5657206be8 (patch)
tree2bbcd35a8c277c933bdafcdac7d7fe7d42f436a4
parent8b166186c1446ebd13b2a7d0ab019c828915f4c2 (diff)
downloadQt-aa29f55547ce72ef6a87c34543face5657206be8.zip
Qt-aa29f55547ce72ef6a87c34543face5657206be8.tar.gz
Qt-aa29f55547ce72ef6a87c34543face5657206be8.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 (cherry picked from commit 7c815bc2d4ea922d75f49f7dc29c81362ce5210e)
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index a8e9de6..dc0c83b 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