This official Trolltech guide to Qt 3.2 programming covers all you need to build industrial-strength applications with Qt 3.2.x and C++. The free CD offers an exclusive version of QT 3 compatible for Windows users worth more than $2000 (more info on this). Download a sample chapter in PDF format: “Layout Management“.
Looks like Trolltech’s plan has been revealed… rather than providing Qt Non-Commercial for Win32 as a free download, they now make you buy a $30 book. Not that I really blame them, and in fact I’ll probably be picking up a copy of this book myself. It’s nice to see a non-commercial Qt 3 available for Windows.
That’s why I am buying the book. I’m sure it’s a good book by itself, but I already know Qt well enough for my needs and have the so-so Qt O’Reilly book. So I mainly am getting it for an actual up to date non-commercial release of Qt for windows. I’ll probably just give the O’Reilly book to a friend now.
For those of you wondering:
The version of Qt that comes with the book is 3.2.1 (yes, for windows). So it’s a pretty up to date release. All they have for download on the trolltech site is 2.2 non-commercial for windows I believe. This book is also supposed to be more thurough and explanative of Qt than the O’Reilly book (“Programming Qt” or something like that). This is my own conclusion as I’ve read about what this book covers, and I feel the O’Reilly book doesn’t cover enough and doesn’t go into enough detail.
So, assuming I’ve only dabbled in C++ (a few hundred lines), if I wanted to pick up Qt, would this book be worth getting? Or do I need an actual C++ book first to understand this one?
i can say i know qt well in both windows and linux.
all i want is the non commercial windows version.
guess its not that hard to find one on the web.
i believe that trolltech releases one book a year with non commercial version and probably theyll put the non commercial version on web by 5-6 months later.
I can’t say how good the book is yet. As for how much C++ you need to know to use Qt. You should learn how to make your own basic classes, then extend them a bit to see how it works. You should know the difference between passing by value, reference, and address. Which also means you should know pointers. Qt likes you to create all your objects (just about) on the heap because Qt deletes them for you later (Qt kinda has it’s own garbage collection).
QPushButton *button = new QPushButton(“Ok”, parentObject);
Hope that helps.
If I missed anything, feel free to add it.
All they have for download on the trolltech site is 2.2 non-commercial for windows I believe.
Well, it’s actually the 2.3 release, although they’ve removed all links from their web site and it’s now only available off their FTP server.
I was told that unlike Qt 2.3 non-commercial the version of Qt (3.2.1) included with this book should work with MinGW although I’ll probably end up reading the book anyway as “Programming with Qt” wasn’t in depth enough to teach me more then the basics of Qt.
I’d like to see the C++ Standard Library as part of QT.
Does anyone one what restrictions there are on the non-commerical windows license for QT3?
Just spotted the license info:
“Licensing-wise, it’s the standard noncommercial license. Your resulting applications must be freely redistributable and source code available. And they have to be strictly non-commercial. Any Open Source license is satisfactory, though you might need to add an exception if you use the GPL. The DLL is freely redistributable WITH your open source application. The license does stipulate that your app must not be a mere wrapper around Qt, so as to export its functionality.”
Eh? What do you mean by that? You can use the C++ Standard Library at the same time as Qt. The QT container classes (QTL) have pretty STL-compatible interfaces.
The thing to note about QTL is that it fits Qt. Qt is very object oriented and quite dynamic. Through moc, it has stuff like properties and a form of runtime type checks that you don’t with regular C++. A lot of the purpose of moc is to bridge the dynamism gap between languages like Objective C and C++. In contrast, the STL is not OO at all (its more functional than OO) and aggressively static. The STL can allow for a very productive style of programming, but ultimately that is a different style from that of the rest of Qt, and thus it wouldn’t really be appropriate to replace Qt’s containers with the STL.
Oh, and it doesn’t help that the STL is designed with such a bent towards performance, that its syntax can be irritating to use, and does stupid things like make operator[] for vectors not range-checked. Qt’s classes don’t suffer from this problem.
I have built Qt V3.2.3 *Commercial* with mingw and it works fine (the resulting dll is shipped with OpendTect, http://www.opendtect.org, which you can d/l for free). If I remember correctly, V 3.2.1 and up should build out of the box with MinGW. I think V3.2.0 also compiles, but requires some tweaking here and there.
However, the Free CD version does not seem to include source code, so you can’t compile it with minGW. All they seem to deliver for win32 are dlls for Visual C++ and the (free) Borland compiler.
Therefore, I’m afraid you’re out of luck, but perhaps the Trolls will be prepared to compile a MinGW dll for you if you ask them.
The CD comes with a Borland C++ compiler – you should be able to get up and running pretty fast
The nice thing about gcc (== mingw) is that it is cross patform. The Borland compiler is only available for win32 (afaik) (and so is MSVC).
… Qt likes you to create all your objects (just about) on the heap because Qt deletes them for you later (Qt kinda has it’s own garbage collection).
QPushButton *button = new QPushButton(“Ok”, parentObject);
One can often see that most Qt objects are created via new, but this is not a necessity. Qt will properly destroy all child objects if the parent is destroyed, regardless if they are created via new, or are members of a widget class for example.
In general, you could even expect a performance gain if less objects are allocated dynamically via new, but I do not know if this is true with the Qt object model.
See for example: http://doc.trolltech.com/3.3/objecttrees.html
Thanks for correcting me there 🙂 . I can get a copy of the borland compiler for free though so even if it doesn’t work with MinGW I still have options.