Today i tried to implement the owner drawn menu item support in Cocoa and MacOSX 10.5
And what i found was pretty scary when i think about QT which i intended to use for some other projects.
If i see it right there is no future for QT on MacOSX becau开发者_如何学Cse the whole Appearance Manager with the exeception of a few trivial functions is completely deprecated in 10.5 (i can't even find a public URL anymore) and even the "Developer" color list and the color "constants" in NSColor are marked as not stable and do not use.
With this policy a Toolkit like QT would have no option then dropping MacOSX support which makes sense for Apple in more then one way (remember Nokia is a competitor). And Apple didn't care about dropping Carbon and Java too.
So do i miss something. Is there any kind of Cocoa Appearance manager or any technique which the QT team could use a reasonable fallback? I'm scared that in 10.7 or 10.8 the apperance might be very different.
And please all people who want to close this question as subjective please consider that i'm asking for a technical work around solution to this problem. Its not a discussion about good or bad but if there is a way to get around this limitation.
It is a serious business decision for me which can easily cost tens of thousands of dollars if done wrong and trusting QT turns out to be a failure.
EDIT: This is a link telling me that even the system colors are not supported anymore Accessing System Colors. And it's correct a theme change to graphite does not result in a color list changed notification.
I gave up trying to make QT look native. It won't ever work because there are too many subtle behaviors that no cross-platform toolkit can ever mimic well enough to fool users. If a native application is the goal, it's going to be much easier to just spend a little extra time making native interfaces for the platforms that you want to support.
The thing that was keeping me from dumping QT was unfamiliarity with Xcode and Objective-C. You probably already know this, but you can rename any Objective-C (.m) file in Xcode to compile as Objective-C++ (.mm). This lets you link all the C++ code that you want, right where you need it in your project.
Firefox is somewhat in the same boat as they are largely cocoa based. Their OS X theme engine implementation can be seen here.
- http://mxr.mozilla.org/mozilla2.0/source/widget/src/cocoa/nsNativeThemeCocoa.mm
- http://mxr.mozilla.org/mozilla2.0/source/widget/src/cocoa/nsNativeThemeCocoa.h
- http://mxr.mozilla.org/mozilla2.0/source/gfx/cairo/cairo/src/cairo-quartz-surface.c
They are relying on Cairo (a platform neutral drawing API) sitting over Quartz to do their rendering.
精彩评论