Gtk2.0 and Qt

Having coded using Qt3 for 2.5 years and viewing the changes made to Qt4, I can say I’m not particularly impressed with it as a whole. My recent need for a UI toolkit lead me to try Gtk (specifically Gtkmm) and I have to say, I’m very impressed.

Trolltech are always adding new bells and whistles to Qt which are always pushing the barrier, but the core classes are still horrible to use.
In Qt3, empty QStrings can lead to NULL dereferences, many classes have highly inconsistant method names or are lacking basic functionality and then theres the monstrocities that are the widgets like QListView and QTextArea (don’t even attempt to edit rich text in one of these) which are unfortunately critical to an application. These core issues made even basic development a nightmare.

The sheer number of quirks that I experienced during my time using Qt makes me wary of ever using it without questioning how much of the API I would need to interact with.

I’ve always been curious about the internal design and usability of Gtk and so I took it upon myself to try the Gtkmm library, which provides C++ bindings to Gtk2.0.

From the outset I was presented with an amazingly clean, well thought out interface to all the functionality I needed. When delving into the documentation, functionality is exactly where you’d expect it in a class named exactly what you would have called it yourself.

Getting a Gtkmm test application up and running took no more than 30 minutes including download and installation.
The removal of the MOC step is a bonus, I was never fond of this. Qt’s MOC does provide a great source of Meta-data which seems to really be paying off, but it also imposes limitations. Not supporting templates or dual-inheritance can be a real pain. Gtk2.0 provides the same Meta-data capabilities from what I’ve seen but I believe the data must be manually defined. Gtkmm also has the same limitation for dual-inheritance.

That being said, both provide headaches when wanting to create custom widgets, which every application will inevitably need to do. The initial dive into both is quite over-whelming. Some objects which may appear to perform simple functionality are split up into a few separate classes which makes things that bit more complex, but at the same time you can see why it’s been done and it does make sense.

I had the impression that Gtk development on Windows was an adventure that shouldn’t be considered. Previous releases showed the lack of work on the Windows versions of the Gtk libraries, but I can easily say that if that was true then it is far from true now.

I highly recommend developers to try out both libraries, for all it’s flaws, Qt does provide a lot and is constantly evolving and gathering momentum. But I really do recommend people take a look at Gtk2.0 and Gtkmm.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: