Subnavigation

A Bridge Over Troubled Water

For a while now, I've been spending my non-bug-fixing time on the Qt Jambi AWT Bridge, an integration layer which will make it possible for you to place your favorite AWT and Swing component hierarchies inside your Qt windows and the other way around. This should hopefully prove to be at least a very convenient tool for anyone who wishes to port their Swing applications to Qt Jambi (which is something I, with the best of intentions, encourage people to do on a regular basis.) It should also allow you to use any of the GUI components out there which were written to be used together with AWT or Swing.

The Qt Jambi AWT Bridge began its life in a hotel bar in San Francisco during JavaOne 2007, almost like a game of chicken. Gunnar started writing the QComponentHost, I started writing the QWidgetHost, and at least for my part the primary goal of this was to see if he'd give up before I did. It was fun and the code was an awful mess, which is a side effect of fun.

Hey, here's proof of how much fun we had and also an example of QWidgetHost in use (I've used this screenshot before, but it's so much more relevant this time):
Proof of funcept
(click for big)

Then, at some point, Gunnar must have decided it was a good idea to formalize it, because it suddenly showed up as a scheduled task in my task manager. I started working on it, and then product management started asking me on a regular basis whether it was done, which means it had become serious business, and, more importantly, that Gunnar chickened out before me.

So, long story short, I just made some finishing touches on the focus handling today, and I decided it was time to let people try it out, so that we can catch the bugs early. This means, of course, that it's a far from a perfect solution at the moment, but it works pretty well for the examples I have, and I'd like feedback to know where to proceed. See the project page for a list of known issues.

Technically, it's not very complicated. The current incarnation consists of a few lines of OS specific code which reparents a native window handle, thus placing it inside another native window without the toolkit's interference. This takes care of showing the widgets in the right place on screen, and the OS takes care of most of the other stuff, like delivering the correct events to the correct event queue. The most challenging thing was to connect the Qt and AWT focus subsystems, because, quite frankly, the latter is a complete and utter mystery to me, and I don't know if I'll ever fully understand that immense and intricate collection of concepts and awesome method names which are synonyms. I sincerely hope I have something which works now, though, but I anticipate getting a lot of bug reports for this particular part, so if you want to help out, please try navigating through your application with the keyboard and see if the tab order makes any sense at all. If it doesn't, let me know, and please send me a compilable example if you can.

Questions and feedback can be addressed to our Qt Jambi Interest mailing list and the project page is right here. Have fun with it and let us know how it went.

(PS. Samuel came up with the title of this post, and it sums everything up perfectly so I stole it.)


Blog Topics:

Comments