How do I tell on Mac OS X if I have the Carbon or Cocoa version of Qt installed?
I installed the QtSDK, but I can't find any documentation anywhere that specifies whether it uses the Cocoa or Carbon version. Can I find out which got installed? If not, is it safe to install the Cocoa vers开发者_JAVA技巧ion from the Library only dmg? Qt version is 4.6.3, system version is 10.6.4.
When using qmake, the following should work:
There is QT_MAC_USE_COCOA
, so a simple test would be:
...
#ifdef QT_MAC_USE_COCOA
std::cout << "Cocoa!" << std::endl;
#else
std::cout << "Carbon!" << std::endl;
#endif
I don't have a Mac nearby to test put checking the type of QPaintEngine might do the trick. I believe Carbon would return QPaintEngine::QuickDraw and Cocoa QPaintEngine::CoreGraphics but I'm not sure.
To quote:
The current binary for Qt is built in two flavors, 32-bit Carbon and full universal Cocoa (32-bit and 64-bit). If you want a different setup for Qt will use, you must build from scratch. Carbon or Cocoa is chosen when configuring the package for building. The configure process selects Carbon by default, to specify Cocoa use the -cocoa flag. configure for a 64-bit architecture using one of the -arch flags
10.4 Tiger Carbon 32 PPC/Intel Yes
10.5 Leopard Carbon 32 PPC/Intel Yes
10.5 Leopard Cocoa 32/64 PPC/Intel Yes
10.6 Snow Leopard Cocoa/Carbon 32 PPC/Intel Yes
10.6 Snow Leopard Cocoa 64 Intel Yes
More information is available on http://doc.trolltech.com/4.6/developing-on-mac.html#carbon-or-cocoa.
精彩评论