Trolltech was very kind to send us over a copy of the recently released “C++ GUI Programming with Qt 3” book, part of “Bruce Perens’ Open Source Series”. The book weighs in at about 400 pages and comes with a CD-ROM loaded with software not found elsewhere freely.The book is written by Trolltech employees who are also responsible for the excellent online Qt documentation. There is a foreword from Matthias Ettrich, the KDE founder, and a brief Qt history.
This book is not for programming newbies. Some knowledge of C++ is required in order to understand the book. The first chapter is very simple and most people will be able to follow it very easily, but after that point, previous programming experience would be required.
The book is very rich in delivering the right information: it discusses UI creation (including custom widgets) using code (as opposed to just using Qt Designer), layout management, event processing, graphics and OpenGL, D’n’D and I/O. There are also chapters about Qt’s API for networking, databases, XML (SAX and DOM) and internationalization. Of special interest (advanced) are the multithreading and the platform-specific features discussed at the end of book. The appendices include installation guide for Unix, Windows and Mac, and the Qt class hierarchy map.
The CD-ROM includes Borland C++ 5.0 Non-Commercial edition for use with the 3.2 Qt version for Windows (also non-commercial). Unix and OSX versions are also included accompanied by SQLite and the book’s code samples. The fact that the book includes the Qt NC 3.2 for Windows (not found elsewhere for download) makes it worth its $32 US cover price even more.
The book reads like raw documentation, there is no “personal” tone anywhere aside from the first few pages. The fact that the book was written by the documentation guys at Trolltech probably has something to do with this. There is a lot of code throughout the book, however, the explanation of the code is not always very detailed. I believe that existing Qt developers or experienced C++ programmers will love the book, while new Qt developers will have a bit of hard time following it in some places.
I believe the book should have had two more chapters though: one for Qt/Embedded & Qtopia and one specific to KDE. Trolltech is going strong with Qtopia on phones and PDAs recently, so at least one chapter about it should have being there. Also, a primer for using Qt with KDE libraries would also be very welcome. While KDE libraries are not part of Qt, it’s a fact that most Qt programmers in the world are also KDE programmers who would appreciate some “all around” information regarding the relationship of the two APIs.
Generally speaking, this is the only book about Qt that discusses a recent version of Qt, so programmers who want to really learn Qt should definitely take a look at this offering. It not only explains how to program for Qt, but also, in some cases, why the API is the way it is. If you are looking into coding a multi-platform application that isn’t Java-based, this is the book you need.
Buy “C++ GUI Programming with Qt 3“
i would like to see Trolltech abstract System Tray/Menu Bar/Task Bar functionality. While being called different things, all three provide similar enough functionality between KDE, OS X, and Windows respectively, that i don’t think its unreasonable to get it abstracted as well.
other then that Qt is great. so easy to use, so easy to write good clean code with, and a blessing for portability on the three main choices for desktops! cheers to the Qt team!
The book was pretty good, but should of had more personality and it should have included C++BuilderX (bccc 5.6)NonCommercial so that the people get the full, albeit non commercial edition of both Borland C++BUilderX and Qt 3.2.
I also think it would have been worth it to delay until Qt 3.3.
For anyone wanting to use this book to get a non-commercial Windows license for Qt3.2 for use with Python/PyQt, forget it.
The PyQt people are not going to produce a Windows non-commercial version to go with this book’s Qt.
Although if you look hard enough, you can find a non-commercial Windows PyQt along with the BlackAdder demo support files (http://thekompany.com/products/blackadder/demovers.php3)
I’m using the commercial win32 version at work, compiled with mingw32.
I heard that the CD delivered with the book does not contain whe win32 source code, only dlls. Is this true?
If yes, does it contain a dll to be used with MinGW?
In other words: Does it include MinGW support?
How does this book compare with the O’Reilly book titles “Programming with Qt”?
You only need the dlls, if you don’t want to access the dlls functions directly via DLLGetHandle() and instead want to use an import library for the dll you can use the dlltool to create one:
Looks like another must buy.
I am intrigued by the Qt dual lincense for $ and for non $. Does the Qt world make it work for TrollTech, ie does TrollTech lose much to any commercial company that doesn’t pay or is the market fair?
Does any other company use similar dual license?, I am interested in applying it myself to other HW/SW intellectual property. I want lots of people using it for free to establish technology, but also some proper $ licensing for vol users.
Every day there are more companies doing so-called “dual license” software.
MySQL is certainly successful. Sleepycat / Berkeley DB is another one. I’m sure there are many others.
IIRC, SleepCat has a similar approach for BerkleyDB, but do check.
“You only need the dlls”
I am afraid your suggestion won’t work. Unless I’m totally mistaken, your suggestion will only work with C code, not C++ code.
I think it is next to impossible to use C++ across compilers, because the internal C++ data structures and the function name mangling is virtually guaranteed to be different between compilers.
So, AFAIK you *will* need dlls compiled with the compiler you want to work with.
I want to start GUI programming with C/C++. And this is one of the only books I can find on the subject. What other books are out there to help a newbie?
if you want to start with the qt, check out the unofficial as well as the official qt tutorials. they are extensive in trolltech’s site.
I believe that the PSI project (http://psi.affinix.com) has the tray icon abstracted. Also, this was posted earlier today on the Qt mailing list:
If anyone’s trying to order the Qt book “C++ GUI Programming”, you’re going to have to wait a while. This is the message I got from Amazon:
Regarding your order for “C++ GUI Programming” (ISBN: 0131240722), we wanted to advise you of a change in availability.
Unfortunately, the publisher has informed us that they are currently out of stock of this title. However, a reprint has been scheduled for 18 March, 2004. Please note that this may be subject to further delay.
Seems this book has been more popular then they expected.
I ordered it from Amazon on Monday, and it is supposed to arrive on Thursday.
I’d like to find a similar book, but for Python instead of C++, for the latest Qt versions (3.x)
Any tips appreciated…
Just use the regular Qt reference and docs. The API is the same whether its Python or c++. There’s really not much a python/pyqt book could offer that is not in the c++ book, other than a python tutorial, but thats not what these books are about. This is a very common request/query, and I honestly can’t figure it out.
API is API. if you know your language, the API docs will makes sense.
There are some subtle things that make working with PyQt different from working with C++ Qt — for instance in the signals/slot mechanism, or the conversion between Python strings and QStrings. My book on PyQt (http://www.opendocs.org/pyqt) was quite succesful, and I still get a fair number of queries about it. (The publisher has quit distributing it to Amazon, it seems, and has removed his own shopping app, so I’m reduced to distributing my author’s copies.) I’d do an updated version if I had the time, and if I weren’t busy learning C++ and working on Krita.
Thanks for the info Boudewijn.
Is there a place where I can download the book as a single pdf file? I usually like to print it at work and read it at the subway…
Actually, the GPL port of Qt 3.0 to win32 is nearing completion, and it works pretty well and fast at kde-cygwin.sf.net I ported
a few apps to it and it works suprisingly well (specially displaying all the widgets) the problem is that they really lack developers
to finish all the little details like file selection dialog and many other little things..
QT is not STD C++ compliable, and I don’t like their license. I use wxWindows in all of my projects instead. Take a look and see how nice it is at
exactly which part of Qt is not STD C++ “compliable” (a combination of compliant / compatable?)?
and since you brought it up, IME wxWidget is nice but not as well designed, documented or supported as Qt is =)
“QT is not STD C++ compliable, and I don’t like their license. I use wxWindows in all of my projects instead. Take a look and see how nice it is at
thats bcoz the signal slot mechanism has not equivalent in std c++. c++ itself wasnt standardised when qt came out first and the c++ template mechanism is still very close to macro expansion that a generic framework. the standard libraries also didnt exist. once the qt moc parser works over the specific parts the rest is done with gcc. so its no fault of qt.
Maybe you missed it, but if you apply a C++ compiler to Qt´s source code, it builds, giving no errors.
As far as I know, that´s a pretty good proof of it being C++.
Maybe it´s not the C++ you like, or doesn´t use your pet feature, but saying “it´s not C++” or even “it´s not standard C++” is stupid.
I used to dislike the Qt way of doing C++, until I really understood why it is the way it is. C++ is a very static language. Its template mechanism, which is the focus of most recent innovations in C++ design, is especially so. GUIs, however, are particularly well suited to a dynamic language. Consider: why are developers so enamoured with Cocoa and Objective C? Its because Objective C is a dynamic language, and Cocoa is a well-designed API that takes advantage of that dynamicity.
Moc buys you a lot of things that C++ just doesn’t do. Qt’s signals and slots are a lot more flexible and easy to use than a template-based mechanism. Further, moc gives you a general property mechanism (especially useful for things like Qt Designer), extended runtime information, persistance of properties, etc. The explicity hierarchy of objects created by QObject also greatly simplifies memory management. All of these things address some fundemental limitations of C++ as a language for coding GUIs.
Read the rationale for moc at the TT website: