C++ GUI Programming with Qt 3
I didn't have to force myself to read this one: the book grabbed my interest from the beginning. It's filled with just enough technical details to whet my technical curiosity, keep me turning pages, and provide the important information, clearly and concisely. I don't have much Qt development experience (none at all yet), although I am experienced in other windowing toolkits. The book quickly provided me with everything I need to know to get up and developing an application, and now I know where to quickly start.
Who's it for? I am of course a novice Qt developer, yet one with a fair amount of IT experience, specifically with other windowing toolkits. I found this book not only a great introduction for those who want to get started with Qt, but it's also a trove of information for somewhat intermediate Qt developers. It's not for people who work for Trolltech or have already been developing feature-rich KDE applications; however, besides providing a great point of entry for new Qt developers, the book does touch on some more advanced topics. Technical books tend to age quickly, but I should note that the book is written by some of the people who brought us Qt 3 and are working on bringing us Qt 4, so this book should have a degree of forward compatibility. What can I expect to learn?
The book is divided into two sections: "Basic Qt" and "Intermediate Qt" development.
The basic Qt section covers everything that someone new to Qt would probably want to learn, beginning with a simple application and an explanation of signals and slots (signals and slots work much the same way as windowing events in Java, for example, and can help to tell when a button or key is pressed). Signals and slots help make the sample application functional. This section also introduces the Qt reference documentation, available online as a reference during development, and Qt Designer, for those who want to use a graphical user interface to create components such as dialog boxes. A quick overview of some of the available widgets is next (widgets are graphical elements such as dialog boxes and buttons), which helps to give someone brand new to Qt development a feel for some of the components that come ready-to-build-upon. This is all covered in the first 38 pages of the book.
I should point out that I think that knowledge of the C++ programming language is essential if one is to learn good things from this book (I'm a big proponent of learning through experience, and you'll need to play with C++ code), but learning Qt and C++ development at the same time might help one come up with some interesting project ideas for learning!
After a quick introduction to creating custom widgets and double buffering (used in some cases to prevent screen flicker), the intermediate section starts by hopping right into layout managers, intended to make graphical forms and components beautiful (and more usable), just like tables helped to make HTML beautiful before CSS came around; layout managers help do for graphical application components what the font and alignment settings do for a word processor. The managers included are very similar to those used in Java's JFC/Swing stuff, and they work well. Also covered are methods for creating 2D and 3D graphics, drag-and-drop, and event processing. Compared to signals and slots, event processing gives the developer more control, and becomes important when writing custom widgets or changing the way an existing widget behaves.
Following this are sections on internationalization, providing online help within an application, multithreading for responsive applications, and Qt's platform-specific features. Qt works with Microsoft's ActiveX, for example, although this apparently requires the Qt/Windows Enterprise Edition as opposed to the free edition of Qt. It's important to point out that Qt implements its own threading capabilities, and the section on threads covers this in depth.
ConclusionThis is a great book for those interested in Qt and KDE development, cross-platform C++ graphical application development, and just making beautiful, functional applications. The book provides information that can't be had from the Qt API alone, and it does so in a way that kept me turning pages. Blanchette and Summerfield organized their text well, with logical chapters that make finding tips for that first application possible. This book gets twelve thumbs up from me.
Bill Lorenz is Vice-President of the Linux Users Group of Cleveland and is helping to organize the Ohio LinuxFest, 2004 edition (call for submissions now in the wild!). You can purchase C++ GUI Programming with Qt 3 from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
GTK Tutorial
QT Tutorial
-------
Chunky Bacon
Besides the good reviews the book got on my favorite QT forum -> http://qtforum.org/thread.php?threadid=316&sid=&th readview=0&hilight=&hilightuser=0&page =1
The book comes with a free non-commercial version of the QT-Win( windows ) library ( QT 3.3.1, I believe ). The last time this was available was version 2.3.0, so if you want to get a non-expiring version for Windows, here is your chance.
I also read the book is released under a special copyright license similar to the GPL ( the Perens License ), so that after a few months the electronic format of the book becomes legally distributable. Is that cool, or what?
I can't afford a sig!
Never underestimate the dark side of the Source
programming GUI in C++... it's so nineties!!
A downside to QT is that it is not free under windows. While this might be okay with companies, if you ever considered writing crossplatform OSS programs, this can hamper things. There is a project porting the X11 version to windows, so its not a complete roadblock..
Of course there is always GTK which has been known to also run under windows and OS X. It is not my intention to start any flamewars -- I am just pointing out that for those in favour of either toolkit there is plenty of crossplatformability.
If either TK holds any major advantage its that GTK+ natively supports C code, but also has C++ bindings. The signalmm library that came out of gtkmm is actually really nice, and usable for other projects. However, in that case don't forget about boost, which also contains a signal library, not to mention a *really* nice interface to python (which I'm currently using in a project). Just be warned, you need a fast computer for compiling.
...review everywhere!
Timeo idiotikOS et dona ferentes
I used to be a big fan of cross-platform GUI programming, but having worked on all variations of Windows, Linux desktops, and Mac OS X, I am now against the idea. I now believe if you're going to support a platform, use the native toolkits as they bring a level of consistency that is just not there with cross-platform toolkits. Having to use a GTK or QT-based app on Mac OS X these days proves to be tremendously frustrating. Text boxes don't have spell-checking or auto-completion. The red dot in the window decoration does not change if the document does. In fact, there is often no document-based implementation whereas there would be one if a native solution was developed. On Windows and Linux, the differences may only be cosmetic, but on OSes such as Mac OS X looks are only the tip of the iceberg with the problem. Cocoa widgets look pretty, but they also bring with them a lot of functionality that I've yet to see replicated on these cross-platform toolkits.
So please, when in Rome do as the Romans do.
I was in a similar position, with enough self-taught C++ to read and follow code but with no clue of how to build a meaningful GUI app. The great thing about Qt is that it genuinely makes OOP seem logical, in the way you make a bunch of objects and hook them together. I'd greatly recommend getting a free version of Qt, going through the tutorials and examples (that's the other great thing -- the documentation is superb) and maybe then trying KDevelop and the KDE libraries.
Pardon me for gushing, but the combination of Qt and KDevelop was a truly empowering tool in my hands and I strongly recommend it to anyone in the same boat.
What I'm listening to now on Pandora...
The GPL'd code can be used commercially. In fact, it would VIOLATE THE GPL if they said it couldn't be used commercially. Indeed, most of the software in the linux distro box on my shelf is licensed under the GPL, and I paid good money for it.
What it can't be is proprietary.
I know Slashdot is not known for precision, but on an issue that gets everyone so worked up it's foolish to provoke people like this for no good reason.
microsoftword.mp3 - it doesn't care that they're not words...
Wasn't there a bunch of development on Visual Basic for unix platforms at one time with syntaxes similar to M$ VB from Visual Studio?
Whatever happen to that?
My own two bits: I chose Qt because from the vey start it was easy to use. I wrote my first working Qt program twenty minutes after first taking notice of Qt. Despite the non-standard signal/slot interface, Qt is about as intuitive as a toolkit can be.
At the time, every other GUI programming method used messages. From Xlib through to Win32, all GUI programming methods use messages.
Agh! Xlib and Win32 are horrible GUI APIs! At least Xlib isn't largely at fault --- its not meant to be a full GUI API. Win32, however, has no excuse! Are you honestly telling me you think that Win32 (with its 200 line GUI hello world), is more sensical than Qt???
It is considerably easier to thread a program that does not have a GUI wrapped up inside of a object than one that does not.
Not really. Multi-threading fits pretty naturally with OOP. Look at the BeOS API (which has a lot of parallels with Qt) sometime. Could you give more detail on why you think this is the case?
Object orientation brings bloat: often students would go way overboard in designing a solution, using 30 classes where 5 would suffice.
That's because students, by and large, are stupid. That's why they are in school, to learn. You should have taught them to only use classes when they naturally fall out of the design of the program.
Compilers are not good at OO: compared to C, C++ compilers are immature and buggy.
That was true for the STL and templates, but Qt doesn't use the STL. Qt was very well supported on the compilers of the time. Again, specific examples?
Thankfully, the GTK+ toolkit is winning the battle of the GUI toolkits.
Really now? Seems pretty even to me.
Students these days feel much more grounded in reality when they see their favourite applications such as mozilla, gaim, xchat, and xmms using the same toolkit they do.
Bah! My favorite apps (Konqueror, Kopete, Ksirc, and Amarok) use my favorite toolkit (Qt).
A deep unwavering belief is a sure sign you're missing something...
often students would go way overboard in designing a solution, using 30 classes where 5 would suffice
You were their teacher? Guess who's fault this is.
Those looking for a fully free C++ toolkit should consider wxWidgets. With its superb sizer layouting system, rich api, native look, and great support (You often get replies from the authors themselves on the mailing lists), it is one of the best free toolkits around.
Now, with the new partnership between wxWidgets and Borland, wxWidgets is likely to develop even more rapidly.
Though wxWindows is free, unlike the free version of Qt it is not GPL, thus it can be used for commercial software development without worry.
TerraIM - my pet AIM client project.
Exactly how much code would you have to write to create your project with Qt (or GTK). Well thats EXACTLY HOW MUCH YOU ARE USING OF THEIR CODE. Thats how much time (time = money) you save by using it instead. money/time you didn't have to spend making your project.
With GPL code, you pay for that time/money by giving back to the comunity that provided for you.
With $2400 you pay for that time money by giving back to the comunity that provided for you.
By paying nothing you basically take from the community and ask them to give you money back before they get anything of you.
Don't want to give, don't take.
People like you really piss me off. "They world owes me a job, the world owes me free music, the world owes me free software... But I owe the world nothing, it should pay me for my stuff"
Sigh. If you can't afford the license cost your software must be pretty sucky anyway, as thats barely a couple of months wages.
Because you are a coward?
How awfully nice for you. May we therefore assume that you're more clever than the rest of us?
Qt uses messages. Did you really use Qt or are you making this up?
What makes it easier to thread a program that does not 'have a GUI wrapped up inside of an object' [sic]?
What is so terrible about having a large number of classes? Only the most novice (OO) programmers I've met shy away from creating more than the 'bare minimum' of classes.
What does this have to do with Qt, anyway?
This is plain wrong. There are some great C++ compilers out there and some servicable ones. Intel's C++ compiler and GNU G++ are examples of the former, Microsoft's of the latter. Why did you let students choose their own compiler?
That first sentence is flamebait; the second is inaccurate. Mozilla isn't built on GTK+: perhaps you meant Firefox?
The parent post smells funny. I call shenanigans.
Rik