Mac widget style addons

cocoawidgets.png

Qt on Mac OS X has traditionally used Appearance Manager/HITheme to draw its widgets. This has been a great experience so far, but lately more and more UI elements have appeared as Cocoa views only with no corresponding HITheme API.

So, for Qt 4.5 we went ahead and built an escape hatch: QMacCocoaViewContainer. This class allows you to embed any Cocoa view in a Qt widget hierarchy. Its only drawback is that programmers have to learn the Cocoa API conventions and that odd [function call] syntax.

To try to remedy this I've experimented a bit with using the Cocoa views (or Cocoa cells to be specific) directly to replace the drawing code for certain widgets. So far I've done three classes: QtCocoaPushButton, QtCocoaComboBox and QtCocoaSegmentedButton. The first two are subclasses of the similar Qt classes, while the last provides a visual appearance for QButtonGroup.

I'm currently supporting my dev machine setup: Qt 4.5/Cocoa on Mac OS X.5.
Qt 4.4, Qt/Carbon or 10.4 support can probably be added if there is interest.

The code is available on the git server (Run "git clone git://labs.trolltech.com/msorvigs-cocoawidgets cocoawidgets")


Blog Topics:

Comments