Wednesday, June 6, 2012


While still learning to properly use QtWidgets I thought that it would be helpful to write a small post on it.

QtW is a nice GUI library created by Trolltech and now owned by Nokia. QtCreator ( an application created exactly for QtW programming) allows the programmer to created everything by hand-code or with the help QtDesigner which , in my opinion , feels a lot like Visual Basic . Personally, I like to hand-code rather than simply draw some windows and buttons, because I like to feel that I'm coding .
A great book for QtW beginners is "C++ GUI Programming with Qt 4, Second Edition" by Jasmin Blanchette and Mark Summerfield (NOTE : The book assumes that you already have moderate knowledge of C++) . This awesome book quickly teaches you the basics and lets you step into coding as soon as possible. So after the first 2 chapters you already know how to create windows and buttons and dialog boxes, though the book provides QtDesigner ways to create the widgets from some chapters I think it should have included the "hard" way too ( which it doesn't ) , but perhaps it was created more as a practical book than a fun one :) .
As a comparison , let's take Win32, which though it is a little outdated it is still a reasonable GUI library, with Charles Petzold's "Programming Windows", which is by no means a bad book, on the opposite it is the best Win32 book published, in my opinion . With these two, you will most certainly learn to code for Windows , and you will learn it the best way, the only problem is that it will take you a lot more time and work to create a simple window and even more to create buttons and everything a real application needs.
For me , personally, and I think for others too QtW is more accessible since I'm not a professional and I don't have all the required time to learn how to create an average application at a very slow pace when I could do it , probably with a minimum cost of performance, at a much faster rate .
If you are interested, I would recommend you to look at the both of them and choose the one that serves you better, you should consider the OS you are programming for. Also there are more GUI libraries out there, from which I will mention only few : wxWidgets, GTK+ and MFC .
NOTE: If I'm not wrong , MFC substituted Win32 a long while ago , but I took this example just to make a simple comparison. Also, Charles Petzold's book is from 2005 so MFC could have better tutorials and a better learning curve but I didn't really try it so it wouldn't have been fair to compare it.

No comments:

Post a Comment