今天,我尝试在 Cocoa 和 MacOSX 10.5 中实现所有者绘制的菜单项支持
,当我想到我打算用于其他一些项目的 QT 时,我发现非常可怕。
如果我没看错的话,MacOSX 上的 QT 就没有未来了,因为除了一些琐碎的功能之外,整个外观管理器在 10.5 中都被完全弃用了(我什至找不到公共 URL),甚至“开发者”颜色也被弃用了。 NSColor 中的列表和颜色“常量”被标记为不稳定并且不使用。
有了这个政策,像 QT 这样的工具包就别无选择,然后放弃 MacOSX 支持,这对苹果来说在不止一种方面是有意义的(记住诺基亚是竞争对手)。 Apple 也不关心放弃 Carbon 和 Java。
那么我是否想念一些东西。 QT 团队是否可以使用任何类型的 Cocoa 外观管理器或任何技术作为合理的后备?我担心在 10.7 或 10.8 中外观可能会有很大不同。
请所有想要以主观方式结束此问题的人请考虑我正在要求解决此问题的技术解决方案。这不是关于好或坏的讨论,而是是否有办法绕过这个限制。
这对我来说是一个严肃的商业决定,如果做错了,很容易花费数万美元,并且信任 QT 结果是失败的。
编辑:
这是一个链接,告诉我甚至不再支持系统颜色
访问系统颜色。正确的是,石墨主题更改不会导致颜色列表更改通知。
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 because 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.
发布评论
评论(2)
我放弃了让 QT 看起来原生的尝试。它永远不会起作用,因为有太多微妙的行为,任何跨平台工具包都无法模仿得足以欺骗用户。如果本机应用程序是目标,那么只需花费一点额外的时间为您想要支持的平台制作本机界面就会容易得多。
阻止我放弃 QT 的原因是对 Xcode 和 Objective-C 的不熟悉。您可能已经知道这一点,但您可以在 Xcode 中重命名任何 Objective-C (.m) 文件以编译为 Objective-C++ (.mm)。这使您可以将所需的所有 C++ 代码链接到项目中需要的位置。
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 也有类似的情况,因为它们主要基于 cocoa。他们的 OS X 主题引擎实现可以在这里看到。
他们依赖于 Quartz 上的 Cairo(一个平台中立的绘图 API)来进行渲染。
Firefox is somewhat in the same boat as they are largely cocoa based. Their OS X theme engine implementation can be seen here.
They are relying on Cairo (a platform neutral drawing API) sitting over Quartz to do their rendering.