Qt 4.5

— richardwb on Monday, April 20, 2009 @ 09:16

Qt is a well known cross platform framework. It's probably most well known as the framework on which KDE is written.

Anyway, over the weekend I experimented with it a bit, and in terms of C++ GUI development it's a breath of fresh air. It approaches the ease of use of the .net GUI facilities, which is great for a language with no built in introspection abilities. The "moc" preprocessor that Qt requires (that lets them do things such as signals and slots) you to run on your source files is still a bit weird, but it's really not as bad as it seems.

The Qt framework is also impressively comprehensive, making it very easy to code applications directly against Qt, instead of coding against a particular OS or a particular compiler.

The style of the framework itself is more traditional than the common notion of modern C++, having more of an emphasis on subclassing and overriding virtual functions than on generic algorithms. The memory management system is definitely foreign: they encourage you to allocate on the heap, yet there are very few delete statements. The way it works is that QObjects (Qt's base class) accept a pointer to a parent in their constructor, which makes that particular QObject a child of the parent. When the parent is deleted, it takes care of deleting all its children. It's a change from RAII, for sure.

It also takes a couple of hours to compile Visual Studio compatible versions of the various components, so don't do it as a last minute thing.

comments powered by Disqus