Qt and Glib

Note: This is my first blog posting ever, so please bear with me. ;)

There has been quite some talk recently at Trolltech about how well Qt "fits" together with other software components on the X11 desktop. We do a fairly good job of it already by providing the QAbstractEventDispatcher API in Qt 4. This has allowed people to plug Qt into the Glib main loop fairly easily, resulting in an application that can use any of the Qt, GTK+, KDE, and GNOME APIs. This is quite powerful, but has one significant drawback: if your application is designed to allow third-party extensions (i.e. plugins), you have to know in advance what kinds of integration to provide. Consider a Qt application tries to load multiple plugins, where each plugin uses GTK+. If the Qt application did not provide some sort of integration into the Glib main loop, what happens when each of the plugins tries to? I have the solution... :)

Yesterday, I got Qt running on top of the Glib main loop. By using the QAbstractEventDispatcher API, I was able to completely replace the entire event dispatching mechanism of a Qt 4 application with less than 600 lines of code. What does this mean? No integration; the scenario above is now possible, since Qt would already be running a Glib main loop. I can now write an extension to my programs with any toolkit I want. Even more attractive is the idea that I can now write a Qt based extension to any GTK+ or GNOME program. Just think... I could write a plugin for the GIMP or for Eclipse, I could use the asynchronous GNOME VFS API. I'm sure there are possibilities I haven't even thought of yet. And that's the whole point: the possibilities are endless.

Of course, this is all useless if only I can do it. I envision applications and frameworks in the future that give Qt, GTK+, KDE, and GNOME programmers the same flexibility that Windows programmers get with COM and ActiveX. I've talked with Matthias (mostly to brag about what I had done), and he was very interested in getting this code into Qt, possibly as soon as Qt 4.2. We both agree: the ideal would be for all applications on the X11 desktop to use the same event dispatching mechanism. Here are Trolltech, we think the Glib main loop should be that mechanism...


Blog Topics:

Comments