Mac OS X 10.9 (Mavericks) was released yesterday. And those nice people at Apple made it free, so you can be sure lots of people are downloading it. However Qt 4 apps look at bit strange on the new OS. Look at the text alignment in these buttons:
The text isn’t centre aligned. It doesn’t look like much of an issue out of context. But it looks wrong when you look at a whole UI. The good news is that there is a simple fix:
#ifdef Q_OS_MACX if ( QSysInfo::MacintoshVersion > QSysInfo::MV_10_8 ) { // fix Mac OS X 10.9 (mavericks) font issue // https://bugreports.qt-project.org/browse/QTBUG-32789 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); } #endif
You need to place this code in your main() before creating your QApplication. For more details see this bug report.
With the fix the buttons look like this:
Much better! There are some console warnings:
CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
I am not sure how how significant these are.
I have also found that updating to Qt 4.8.5 fixes a printing crash bug in my table plan software. This crash happened when rotated pixmaps were printed from Mac OS X 10.8.
I have seen on forums that Qt 5 is completely broken on 10.9. But I don’t know if that is true.
could you paste your ./configure. i even cant build qt 4.8.5 on os x 10.9
I updated XCode at the same time and I had to do a fair bit of buggering around to get building again. Hints:
-reset the compiler in projects>build and run>kit (or something like that)
-start xcode and accept the agreement
HTH
Sorry, I didn’t make that very clear. I could get my product to build against Qt 4.8.5 on 10.8. But I couldn’t get 4.8.5 to build on 10.9.
We’ve also found a bug associated with QDir::currentPath() returning the correct path name for the location of the running Qt application. Any suggestions for a work around for this?
Just had a quick play with PerfectTablePlan on 10.9 and there does seem to be a problem. Ugh. I hope Digia can come up with a version of Qt 4 that work ok on 10.9 soon.
John has posted the bug report here:
https://bugreports.qt-project.org/browse/QTBUG-34300
I am trying to build Qt 4.8.5 on 10.9 with the very latest release of Xcode. It fails building webkit (which I don’t use). So I am trying to build it again with:
configure -no-webkit
I am getting 1000s of “this version of Mac OS X is not supported” warnings.
The 4.8.5 build now fails with:
qcorewlanengine.mm:637:53: error: use of undeclared identifier
‘kCWInterfaceStateInactive’
It looks like these problems were known about months ago:
https://github.com/mxcl/homebrew/issues/21000
I guess I will have to hope for Qt 4.8.6 that fixes these various issues on 10.9. Not very happy. Digia seem to have dropped the ball here. It isn’t as if they haven’t had ages to prepare for 10.9. But there is nothing on http://blog.qt.digia.com/ .
I tweeted qtproject and this is there response:
@successfulsw We’ve been thinking of making a 4.8.6 release, but we can’t promise fixing all Mac 10.9 issues.
Not very encouraging. If they weren’t intending to support 10.9 on Qt 4 then I wish they had announced this months ago, so I had time to move my app to Qt 5.
Over Mac OS X 10.9 QDir::currentPath() return “/”. Any QT 4 fix for this?
I also discovered a work around while still staying with using Qt calls.
QApplication::applicationDirPath() appears to work properly on OSX 10.9 Mavericks. So using that and QDir cdUp() 3 times will get you the application folder, since it returns the executable location inside of the mac app bundle.
This works for Qt4.
Thanks for the post. Qt 5.1.1 works fine on OS X 10.9 release version, except for this same font problem. Previous versions of Qt 5.x would crash.
Groan. Here is another one.
getSaveFileDialog() does not respect the proposed directory
https://bugreports.qt-project.org/browse/QTBUG-27664
Same issue for QFileDialog::getOpenFileName(). You can work around it by passing in the QFileDialog::DontUseNativeDialog flag. But this means you get the ugly non-native dialogs.
QFileDialog::getSaveFileName() works for me as you would expect. I keep a QString around that contains the last directory used.
Turns out this is a 4.8.4 problem, fixed in 4.8.5.
I have posted an update on QDir related issues for 10.9 here:
http://www.qtcentre.org/threads/56730-Can-you-reproduce-these-Mac-OS-X-10-9-issues-on-Qt-4
>The good news is that there is a simple fix
Much appreciated, Andy! Your fix worked for me. Now if Digia would only fix this Qt 4.8 issue which affects OS X 10.7, 10.8 and 10.9:
https://bugreports.qt-project.org/browse/QTBUG-27881
Good. Note that I just reported the fix here. I wasn’t the clever person that thought of it.