Back to Blog home

Qt/Mac Cocoa Port Alpha Released

Published on Monday March 03, 2008 by admin in Qt News | Comments

You may have remembered that in the past I've talked about some of the development of 64-bit applications on Mac OS X. The gist of it is that Apple changed their position on supporting 64-bit Carbon, the library we depend on for running Qt GUI applications. It became obvious early on that Apple wasn't going to change their position on this, so it left us with two choices:

  1. Keep Qt Carbon-only and forego 64-bit support.
  2. Create a port of Qt that used Cocoa as its backend.

Naturally, since we already support 64-bit on the other platforms and since the idea of using Qt is to help insulate you from changes such as this, we decided on the latter option. It did mean that we had a bit of work ahead of us, since we had to re-write some of the internals of Qt (particularly widgets and events), but most of the other modules were already there.

I'm happy to say after a bit of work, we've made progress and we're proud to offer an alpha for curious people that want to try 64-bit applications on Mac OS X 10.5. It is based off a fairly recent snapshot of 4.4.0, so it will have all the bugs and features of 4.4. There still is a lot that doesn't work and there's a way to go (hence the term "alpha"). On the other hand, having more people try it out will help us find bugs and will make it much better (there's only so much we can test locally).

Here are the links for the
open source package
and the commercial package.

The official press release is here (along with an ouroboros link back to this blog post).

The place to offer feedback is on the qt4-preview-feedback mailing list. Please consider putting something about Cocoa in the subject so that it gets to the right people.

By default, the package is built in 32-bit (in case you happen to not have a 64-bit machine). To build in 64-bit pass -arch ppc64 or -arch x86_64 (if you want to build 64-bit universal, pass both). I would also recommend passing -prefix $PWD so that it is not necessary to run make install. I'm not sure make install works in this package.

Since we aren't putting up the documentation for the alpha up (it's pretty much the same docs as 4.4), I'm reproducing the known issues for this package here:

This document explains the current list of features in the Qt/Mac Cocoa port that are currently not working. Most of the issues will be addressed in upcoming snapshots and beta releases. We hope that all the issues should be addressed by the time the of the final 4.5.0 release.

What Works

Here are the things that we can say about the current state of the Qt/Mac Cocoa port.

  • 64-bit Support: The Qt libraries currently do build and link as 64-bit frameworks and it is possible to build and run many of the Qt examples as 64-bit.
  • HIViews are now NSViews: Every QWidget is now backed by an NSView pointer instead of an HIViewRef. QWidget::winId() will return an NSView pointer that can be used in other Cocoa technologies (e.g., Core Animation).
  • Some Native Dialogs Work: QFileDialog and QColorDialog have been ported to use NSOpen-/NSSavePanel and NSColorPanel respectively. QPrintDialog and QPageSetupDialog are not in this release, but are on their way. Currently, none of these dialogs show up as sheets pending the creation of an asynchronous API.
  • Painting, Printing, and Styles: Since printing and painting used Quartz 2D and styling used HITheme, these sub-systems work without any changes.
  • OpenGL: OpenGL is fully supported,including pixel buffers and framebuffer objects.
  • Clipboard: Using QClipboard to copy and paste data works as expected.
  • Mouse, Keyboard, and Wheel events: Mouse, keyboard, and wheel events are dispatched to the proper widget. The Qt/Mac Cocoa port respects Cocoa's idea of a "First Responder."

Current Known Issues

The following are items that don't currently work, but that we plan to have resolved before the final release of the Qt/Mac Cocoa port. Please do not file bugs on these.

  • Carbon Support: The current source tree for the Qt/Mac Cocoa port contains source for building Qt/Mac with Cocoa. It contains some of the source code that is used for the Carbon port, but it is currently not set up to build the Carbon Qt/Mac libraries. Please use a normal release or snapshot if you want to use Carbon.
  • Drag and Drop Support: Drag and Drop is currently not implemented and needs to be ported to Cocoa, but using the clipboard does work at this time.
  • Accessibility: Accessibility support is not implemented and needs to be ported to Cocoa.
  • Text: Most text rendering works fine for Latin-1 characters. However, rendering non-Latin-1 characters has not been tested.
  • Input Methods: Input methods also need to be ported to Cocoa.
  • Shortcuts: Shortcuts that exist outside of the menu bar may not be dispatched.
  • Tablet Support: The tablet support has not been ported from Carbon yet. However, it should still be possible to use the tablet as a mouse.
  • Phonon: Phonon uses the QuickTime backend that is only available on 32-bit. Using Phonon in 64-bit requires a QTKit-based backend and has not been done.
  • Unified Toolbar: The QMainWindow::setUnifiedTitleAndToolBarOnMac() method currently does nothing.
  • Dialogs, Tool Windows, Sheets, and Drawers: At the moment, all windows are subclasses of NSWindow. This means that window types like drawers and sheets do not work and tool windows do not get the right decorations. Modal dialogs do show up at the correct window level, but are not yet considered "panels." Many window flags are not recognized.

Things We Don't Expect to Support

The following items that we do not plan on spending any resources on unless there is monumental outcry for their inclusion.

  • Qt3Support: At this time we have no plans for making the Qt3Support module work with the Qt/Mac Cocoa port in 64-bit mode. Following in footsteps of Apple, we would like to encourage you to consider the time of going Cocoa and 64-bit as a chance to jettison Qt 3 constructs and classes.
  • Support for versions of Mac OS X below 10.5: We are using methods and classes that are only available in 10.5 and higher. Most of these functions don't have any equivalent on earlier versions. We recommend using the Carbon version for earlier versions of Mac OS X. We anticipate keeping the Carbon port supported at least for the lifetime of 4.5.
  • Support for -no-framework or -static: Cocoa requires that we load a nib in order to properly access the global menu bar. This nib has to reside on disk somewhere. The most logical place for it to reside is inside the QtGui framework. For this reason, building Qt as standard "dylibs" or statically is no longer supported.

Subscribe to Our Blog

Stay up to date with the latest marketing, sales and service tips and news.