Starting Programming with Qt - Books for Beginners


On the 14th of January Nokia, who recently acquired Qt and its developers, Trolltech, issued an important press release. It announced that as from the next version of Qt (version 4.5 due in the next couple of months), it will be licensed under the Lesser General Public License (LGPL).

Qt (usually pronounced 'cute', although out of habit I still tend to refer to it as 'queue-tee') is an extremely well respected cross-platform C++ GUI library. It forms the basis of the KDE desktop, and can be used for Windows, Linux and Mac development. The main problem with it up to now has been that, although open source versions of the library have been available, commercial licences have been too expensive for most individual developers.

Releasing Qt under the LGPL will change all that, since it means that Qt can be used in non-open source offerings without the need for a commercial licence. The C++ community has not been slow to notice this, and a number of people have asked me, as an existing Qt user, what books I would recommend for programmers new to Qt.

A search of Amazon UK pulls up about 15 books with Qt in their title. That looks daunting, but it's not as bad as it seems, except as a trap for the unwary. We can immediately say that we are only interested in books published in 2006 and later. Why 2006? Because in late 2005 Trolltech launched Qt 4 which was a major rewrite. You will not find books on Qt 3 to be a great deal of use!

By the way, I was fascinated to find there is a medical condition called QT - I did wonder if 'Acquired Long QT Syndrome' was something specific to programmers!

This brings us down to half a dozen choices. One of these is about PyQt programming, which I'm not dealing with in this article, and one, 'An Introduction to Design Patterns in C++ with QT 4', is not really about Qt, it just uses Qt in its demonstrations of different patterns. Two of the others are different versions of the same book, so, in practice there are three choices.

1. C++ GUI Programming with QT 4 by Jasmin Blanchette and Mark Summerfield
2. Foundations of Qt Development (Expert's Voice in Open Source) by Johan Thelin
3. The Book of Qt 4: The Art of Building Qt Applications by Daniel Molkentin

I have used the first two extensively, but not, unfortunately the third, so I will have to pass on that one. (If anyone wants to send me a copy, I will include it in this comparison!)

I have the June 2006 edition of the 'C++ GUI Programming with QT 4' book. There is a new version just out this month (February 2008), but it's hardback and costs an eye watering £42.99, so I think I'll wait until the paperback version arrives before deciding whether to upgrade.

So, it comes down to a choice between two books, ' C++ GUI Programming with QT 4' and 'Foundations of Qt Development'.

Let me start by saying that both are very good books, both for learning to use Qt, and for use when you first start using a new facet of the library. Neither are what I would call reference books, and there is a good reason for that - Qt has some of the best reference documentation I've seen in a very long time.

Both books are pretty comprehensive and cover much the same material in similar depth. I suspect that choosing between the two is a matter of personal preference. In an ideal world I'd suggest getting both of them! Two books on the same topic can be very useful when you are starting something big and new - if you don't understand one author's explanation, then there is a good chance you will understand the other.

If I were writing this article a few years ago, I would have recommended going in to a good technical bookshop and browsing through each book to decide. Sadly, such opportunities are much diminished with the rise of Amazon.

So which one do I, personally, use?

Well, I bought 'C++ GUI Programming with QT 4' when it first came out, and I used it for a lot of my early Qt programming. Later on I bought 'Foundations of Qt Development', and I found it clarified a number of issues that I was still fuzzy about. Now I find that the first book I turn to when I'm Qt programming is 'Foundations...', so I guess it has become my de facto book of choice.

The question of why is complex and difficult, but I think what it comes down to, is the fact that 'C++ Gui...' is written by two people who were heavily involved in the development of Qt. This gives them a subtly different perspective on Qt, and it comes through in the book. 'Foundations...', on the other hand is a marginally better fit with my applications programmer's mind set.

It's perhaps easiest to explain with an example. Qt has its own container and string classes. 'C++ Gui...' devotes a chapter to using these classes, while 'Foundations...' relegates them to an appendix. An applications programmer who already knows and uses the STL containers, is much more likely to continue using the STL, and will only need to use the Qt variants where they are used by Qt components.

Two other examples. 'Foundations...' has a whole chapter on building Qt Projects. 'C++ Gui...' also has that information, but it's scattered throughout the book. This is an issue which can be quite vexing, and programmers appreciate organised information that allows them to get up and running with the minimum of fuss.

Then there is the matter of Unit Testing. Qt comes with its own set of unit test classes. Use of these is covered in 'Foundations...', but not in 'C++ Gui...'. 'Foundations...' also covers how to unit test things like GUI Widgets, dates, and signals - basic fare for a modern applications programmer.

That's not to say 'C++ Gui...' doesn't have its own strengths - for instance the material on platform specific features is very useful. It's just that 'Foundations...' is more my sort of book.

So there you have it - I prefer the 'Foundations of Qt Development' to the 'C++ GUI Programming with QT 4'. But in all honesty, you'd be well off with either of them!

Alan Lenton
15 February 2009

C++ GUI Programming with QT 4 (Paperback) by Jasmin Blanchette & Mark Summerfield. Prentice Hall. ISBN: 978-0131872493

Foundations of Qt Development (Expert's Voice in Open Source) by Johan Thelin. Apress. ISBN: 978-1590598313

The Book of Qt 4: The Art of Building Qt Applications (Paperback) by Daniel Molkentin. No Starch Press, ISBN: 978-1593271473


C++ GUI Programming with Qt4 by Jasmin Blanchette and Mark Summerfield. Prentice Hall

Qt is a C++ cross platform library. It started out as a GUI library, but it has long outgrown that, and it's starting to look more and more like a comprehensive cross platform framework. It's also gaining new features very fast, which is something of a problem for any author.

None the less, this book will provide application programmers with a solid foundation when they come to use Qt. When I did a comparative review of Qt books last year (see above), I didn't have access to this book. However, I recently used a colleague's copy at work, and found it so much more useful, and comprehensive, than my other Qt books, including the earlier edition of this book, that I bought my own copy out of my first paycheck! What better recommendation could you want?

This book is a must for those who need to use the entire framework, since it covers far more than just the GUI, including multithreading, networking (note, though, that it doesn't cover using the QNetAccessManager, which arrived after the book went to print), 3D graphics, using databases, and extending Qt programs with Javascript.

The one real weakness of the book, probably caused by the rapid development of the framework, is that the GUI material basically assumes that the reader wants to program the GUI facilities directly instead of using Designers and/or Creator. I've noticed that there is a little bit of snobbishness in the Qt community, with the old guard maintaining that the only way to work in Qt is via direct programming. Hopefully the next edition of the book will teach GUI programming via the Creator IDE, and the Designer. Lets just see if we can break the 'real programmers program in noughts and ones' attitude in parts of the community :)

So would I recommend this book? Wholeheartedly. My current job has taken me into realms of the Qt framework I've never used before, and this book enabled me to get up speed very fast under a schedule that was very, very, tight.

Highly recommended.

Alan Lenton
21 March 2010


Return to the reviews page

Back to the Phlogiston Blue top page


If you have any questions or comments about the articles on my web site, click here to send me email.