Mac widget style addons
April 17, 2009 by admin | Comments
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
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.5 Now!
Download the latest release here: www.qt.io/download.
Qt 6.5 is the latest Long-Term-Support release with all you need for C++ cross-platform app development.
Explore Qt World
Check our Qt demos and case studies in the virtual Qt World
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.Henkilön Qt (@theqtcompany) jakama julkaisu