summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-11-27 11:18:00 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-11-27 11:18:00 (GMT)
commit38a44a97ee30214c450615f07588d5c2b733b5d5 (patch)
treedecc0c289e29bbb06402a5dd49d0359e21fe9cb3 /src
parentc77a556265847529bb1c55ce3c8ae21080161f38 (diff)
downloadQt-38a44a97ee30214c450615f07588d5c2b733b5d5.zip
Qt-38a44a97ee30214c450615f07588d5c2b733b5d5.tar.gz
Qt-38a44a97ee30214c450615f07588d5c2b733b5d5.tar.bz2
Fix QFontDialog::getFont on Mac OS X when using an invalid initial font
If you passed in a QFont with a family name that did not resolve to QFontDialog::getFont(), it would not select any font in the panel, and it would always return the default font, regardless of what you actually selected in the dialog. This was because it would try to resolve the requested family name, rather than the actual family name of the initial font. That in turn caused the NSFont* returned by the system to be null, which, when set on the font manager, caused the manager to always return 0 for selectedFont. Task-number: QTBUG-6071 Reviewed-by: Trond
Diffstat (limited to 'src')
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 5b0983b..0c467cd 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -625,10 +625,11 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
}
NSFontManager *mgr = [NSFontManager sharedFontManager];
- nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(font.family())
+ QFontInfo fontInfo(font);
+ nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(fontInfo.family())
traits:mask
weight:weight
- size:QFontInfo(font).pointSize()];
+ size:fontInfo.pointSize()];
}
[mgr setSelectedFont:nsFont isMultiple:NO];