Bradley T. Hughes
Qt
KDE
 in Qt, KDE
 on Friday, February 24, 2006 @ 08:12

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…

15 Responses to “Qt and Glib”

» Posted by Max
 on Friday, February 24, 2006 @ 18:09

> Here are Trolltech, we think the Glib main loop should be that mechanism”¦

What?!

Why not try to get the qt main loop into glib 3.0?

» Posted by jayKayEss.com
 on Friday, February 24, 2006 @ 18:53

“Here are Trolltech, we think the Glib main loop should be that mechanism”¦”

That remark sounds like flamebait to me! Watch out… :-)

Does this mean that the integration could go the other way around? For instance, could one compile The GIMP to use the KDE file picker instead of the weirdo GNOME one?

» Posted by mobtek
 on Friday, February 24, 2006 @ 23:13

Very nice, when this is in Qt 4.2 will give me more bragging rights about how awesome Qt is to my mates :P This would be a really powerful option to have.

 on Saturday, February 25, 2006 @ 04:20
Pingback

[…] I wonder if this will hit trunk/ of the Qt codebase. I seriously think this kind of thing is absolutely required in order to move forward and let developers take maximum advantage of their skills. […]

» Posted by Rudd-O
 on Saturday, February 25, 2006 @ 04:23

I just blogged about this on my blog. Sadly, your blog seems not to support Pingbacks. Please enable them.

» Posted by hagaik
 on Saturday, February 25, 2006 @ 06:56

Hey that’s cool! I hope it makes it into 4.2..
But just clear something for me, does it mean that Qt would depend on Glib, or am I just thinking nonesense?

 on Saturday, February 25, 2006 @ 08:00
Pingback

[…] Brad Hards of Trolltech says that future versions of Qt4 (perhaps as soon as Qt4.2) will start using the Glib event dispatch loop. This is downright wonderful news for a couple of reasons. The technical reason is that you will be able to use binary Qt4 plugins in Glib/Gtk apps and vice versa — so you would be able to use both GnomeVFS in KDE, kioslaves in Gnome, Arthur canvas in The Gimp, integrate Filelight with Nautilus… The fact is, on the Linux desktop, some Gtk/Gnome and Qt/KDE duplicate a lot of work. Sometimes the way KDE does something is better, sometimes the way Gnome does it is better. With the new event dispatcher, KDE4 and future Gnome apps will be a lot more free to call each others’ APIs. […]

» Posted by eoin
 on Saturday, February 25, 2006 @ 17:34

Thats actually really cool.

Is there any performance issues with using glib? It seems to me that some extra hackery would have to go into glib to get the most out of its interaction with Qt.

Just a rambling though, I haven’t dug through glib or Qt at all :-D

Either way this is pretty darn neat, and I look forward to see what the devs can pull out of their hats with this trick.

» Posted by Brandybuck
 on Saturday, February 25, 2006 @ 23:44

Will this mean that Qt and KDE will break everything GNOME releases a new Glib? It’s already a pain in the butt when a minor bump in the Glib version causes me to rebuild everything starting with a ‘G’, I think I might go postal if I had to rebuild everything with a ‘K’ as well.

» Posted by vvl
 on Sunday, February 26, 2006 @ 00:03

Sweet, now I guess the only big hurdle would be getting identical themes/behaviour for both QT and GTK+ so that an app/desktop would be completely seamless?

» Posted by bobef
 on Sunday, February 26, 2006 @ 12:52

“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 suggest you give the above programmers the same performace that Windows programmers get, and only after that the flexibility, because recently all my attempts to use Linux end up with the same conclusion: KDE is slow as hell! GNOME is slow as hell! It turns out (in my experince) that often a software that is made on pupose to run slow (to sell hardware) runs faster than open software. I can’t understand what’s the matter. Am I the only one to notice that the major and most usable desktop enviroments for Linux are so damn slow?

» Posted by paul
 on Sunday, February 26, 2006 @ 14:04

Why you have choose glib main loop as main dispatching mechanism?

» Posted by Juan Linietsky
 on Monday, February 27, 2006 @ 21:16

Hi! I’m very interested on this topic and have done some good research about it. Since I’m in the audio development community, having a way to do standard plugins that can instance interfaces without having to resort to really bad hacks (such as core/UI separation via IPC) etc has been a very needed goal. If you are interested (and since you dont provide any means of contacting you directly) please drop me an email.

Cheers!

» Posted by Peter
 on Tuesday, February 28, 2006 @ 17:12

“Am I the only one to notice that the major and most usable desktop enviroments for Linux are so damn slow?”

Yep. :)

 on Friday, August 18, 2006 @ 15:00
Pingback

[…] “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?” […]



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.