C++ GUI Programming with Qt 3
The first question that came to mind when I got this book - is there any need for it? Qt's Documentation is detailed and extensive with how-to's and an API reference available online for free. I have done GUI development in .NET (with C#) and Tk (with Perl) environments, and even though I've never tried Qt, the site with tutorials looked like a sufficiently good resource to start.
However, after getting through the first few chapters, religiously trying out the code, my opinions on whether a separate book is needed have changed. Jasmin Blanchette and Mark Summerfield's book can take a sufficiently clueless newbie with some C++ knowledge and guide him through the intricacies of GUI building, providing practical advice and some bits of experience on the way. You learn about the practicality of this book by turning to page 3 (with page 1 being the title) and seeing a code example as the second paragraph of the first chapter. Writing a basic GUI application in C++/Qt is attractively easy, to win you over and make you read the rest of the chapter, as well as finish the basic introduction by creating a windowed application with SpinBox and Slider widgets.
The table of contents is available on the publisher's Web site and looks fairly simple. Each chapter takes about 20-30 pages, with screenshots and code examples provided as part of the text. Reading the first 5 chapters, which comprise the "Basic Qt" section and take up 110 pages, should be enough for any C++ developer to build a sufficiently complex GUI application if all that's required is some graphical interface slapped on top of the functionality that's already there.
The rest of the book -- "Intermediate Qt" chapters -- take the reader into the common problems of GUI development, providing some insight into more advanced topics as well. Supporting networking, working with graphics and images, internationalization of the software application, interacting with help, reading XML through SAX and DOM APIs, accessing databases and doing inter-process communication are all covered here. The authors tended to avoid inserting huge amounts of reference material into the book, and, for example, in the XML chapter when working with Unicode you will be told to go online and download the numeric values of the Unicode characters instead of dedicating valuable book pages to it.
The language of the book is simple to follow; there are plenty of code examples (with discussion following each), and when the authors make certain choices, they also explain why. The diagrams and screenshots are clear (although not in color), and the code examples can be easily separated from the text. This is the first official TrollTech guide to Qt 3.2 programming, and the authors promise that the techniques will work with Qt 4.
Perhaps part of the positive impression that this book left is the fact that programming in Qt is easy and straightforward. At the early stages of my education, I started learning GUI programming with MFC, which left an indelible image of complexity and will probably increase psychiatrist bills in the future (to be fair to Microsoft, Windows Forms with .NET is a huge step forward). The book and the Qt library made some complex things sound quite simple and enjoyable to program. As Matthias Ettrich notes in the foreword to this book, the most important point in reasoning why Qt is so popular is "because programmers like it."
The book comes with a CD that contains non-commercial version of Qt 3.2 for Windows/Mac/Linux, Borland C++ 5.5 (Non-Commercial) and trial version of Borland C++ 6.0 compilers, SQLite database engine and book source code. The non-commercial version of Qt 3.2 for Windows can be installed for Borland C++ 5.5, Borland C++ 6.0, Microsoft Visual C++ 6 and Microsoft Visual C++.NET environments. The examples are quite conveniently located in folders with chapter numbers, followed by subfolders with example names.
Whether you're looking for general introduction to GUI development with C++ or trying to learn Qt, having worked with other libraries and toolkits before, this book is a good source of practical information and reference. The book is part of Perens' Open Source Series.
Alex Moskalyuk enjoys reading and reviewing books on programming and tech industry in general. You can read his other reviews on his personal site. You can purchase C++ GUI Programming with Qt 3from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
a non commercial version for windows? I thought there wasn't a non commercial version of qt for windows.
Java class files are fundamentally different because you actually can run them anywhere without recompiling.
C/C++ syntax has something going for it; it's very easy to program once you know the syntax. It is also very portable across different platforms. I assume that like many libraries, the functions can be called from a language other than C++, but isn't it cool that so much in the open source community uses a more or less common base language..
_________________________________
http://github.com/gbook/nidb
I personally like the wxWindows library. It's fully object oiented and handles all default behaviors for you. It has a very easy to use message handling system and the documentation is excellent (but should include a screenshot of each control for quicker reference). I once wrote apps is pure win32 API.. *puke* [this was before I really got interested in linux] I now refuse to use anything other than wxWindows.
Advantages of wxWindows:
Fully Cross Platform
Easy to learn API
Object Oriented model is well suited to GUI construction - 1 class = 1 screen object
You really should check it out - www.wxwindows.org
If you cannot keep politics out of your moderation remove yourself from the Mod Lottery.. NOW!
[Speal about what it is/does]
Do you want to add a full fledged configure dialog to your Qt application by only writing one, twenty line function? If so than the KAutoConfig library is what you want. KAutoConfig is several classes that enables a developer to easily create a configure dialog for their applications. It automatically syncs GUI widgets values with values in the configuration file. It does this by looking for keys and widgets that have the same name. It obtains the default values from the initial values of the widgets. KAutoConfigDialog also manages all of the buttons in a normal configure dialog.
-Benjamin Meyer
Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
Qt is probably the best C++ GUI toolkit out there. In my experience, developing an application is extremely easy and straightforward, due to the fact that the people at TT used the simple (yet effective) model of slots and signals. Writing a new event handler is as simple as overriding a method and then connecting it to your widget -- simple as that.
Not to mention the great I18N possibilities, the great XML-based Qt Designer application, etc, etc.
All in all, there are very few drawbacks to Qt, other than the commercial price -- but hey, if you're an open source developer, you get it for free. Otherwise, your employer will get his money's worth back -- simply due to the fact that Qt is such an excellent product.
(No, I don't work for TT -- I just enjoy their products very much)
SCO and Canopy combined own a bit over 5% of TT. Majority of the company is owned by the employees of TT. SCO/Canopy can in no shape or form control TT. And TT can't buy the shares back if SCO/Canopy is unwilling to sell.
So quit your whining.
Lesbian Nazi Hookers Abducted by UFOs and Forced Into Weight Loss Programs - -all next week on Town Talk.
I'm a programmer, but not a GUI developer, so my knowledge of such things is limited. I've used Qt applications, and I've used GTK applications. Personally, I like GTK2, but that's mainly on an aesthetic level, rather than a functional or development level.
I ask anyone who's developed in either/both of GTK/Qt, and even those with Win32 experience. What advantages does Qt have over the other choices?
---
"Every jumbled pile of person has a thinking part that wonders what the part that isn't thinking isn't thinking of"-TMBG
Given Trolltech doesn't even have a website on archive.org prior to the year 2000 I find it a tad bit hard to believe that Sun was later in it's definition of write-once-run-anywhere.
Plus, if we're gonna play those games then I was using Motif on variety of platforms in the early/mid nineties with C without a need for re-write.
So I hardly think QT is a defining standard for write-one-run-anywhere GUI development.
Caution: Contents under pressure
I had the misfortune to read a book on Qt by Patrick Ward called Qt Programming. I'm sorry, but it's got to be one of the worst books on this topic that I've ever seen.
Stay far, far away from it.
Belief is the currency of delusion.
Why are so many GUI systems still closely coupled with specific languages? Why not divorce the GUI engine from languages? I don't know of any library that has successfuly done that. Although Tk comes close, it still requires a specific interpreter be installed.
Table-ized A.I.
However, the generic OS interfaces provided by the Java class library don't cover much more ground than what the POSIX-ish API subset provided by Windows covers. So you can already write relatively portable code in C++ that will run on both *nix and Windows.
At any rate, if you're willing to drink the Qt kool-aid, Qt itself provides a bunch of portable generic utility classes to address this same issue.
where is the Networking chapter?
Oh, I don't know there's a slight chance that Chapter 13. Networking might be remotely related to the topic you ask for?
With Java, there is a free as in beer VM for most platforms and as far as I understand, you can port Sun's code to your platform for free. You can also develop a clean-room VM and call it something other than Java.
With Qt, it's either an expensive license (my company requires a senior VP approval for any software over $150) or your program is GPLed and Linux-only. I guess a clean room port would be Ok though?
I chose Java UI + JNI over embedded Qt before for just these reasons. For C++ programming, I just hope OpenStep really takes off.
It's not the policy of my series to publish proprietary software on the accompanying CD. But there is some Borland stuff and a copy of Windows Qt on the CD. This is due to a mis-communication with my publisher. I found out about it very late in the process (as I was reading a galley proof), and decided to allow the deviation from policy this time rather than cause a tremendous hassle for Troll Tech. The book had already been advertised, and orders had been booked from stores, etc.
Thanks
Bruce
Bruce Perens.
1) C++ (Because I can do everything in C)
That carries about as much weight as saying, "I don't care about women because I can do everything with my hand."
It goes from God, to Jerry, to me.
Does anyone know how this compares with Programming with Qt from O'Reilly? That was the reccommended text for a Soft module I did last term/semester (whatever the uni chooses to call them this week). I thought it covered pretty much everything I needed..and even touched on the aforementioned XML/DOM/SAX stuff.
As LISP coders will tell you, if you're having to think about the "sin tax", it's not user-friendly. Move past that. Think about the semantics. Or as the Bene Gesserit would say,
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Is it "cute" or "cutey" or what?
in girum imus nocte et consumimur igni
Ok I only downloaded it 2 days ago. But it looks really good to me and doesn't have Qt restricitons. After buy both Borland C++ builder and VisC++ I now plan to use only Wx.
...basically you can distribute proprietary binaries without distributing any source code, and neither will wxWindows conflict with GPL code you may be using or developing with it. The conditions for using wxWindows 2 are the same whether you are a personal, academic or commercial developer."
Quote from the FAQ:
"
Speaking of portability, QT is a bit problematic, as they use non-standard C++ extensions to accomplish their purposes. (Something that the GTK C++ extensions purposely avoided.) Similar to what Microsoft has done with C++.
C++ has been my language of choice for the past 10 or so years, but it's sad to see the bastardization happening all over by these toolkits.
It's incompatable with the STL. But not standard C++.
QT is awesome. Its license isn't. Before you dismiss this as another ill-informed troll message, consider this:
I am involved with a university research project. We started developing our app using QT, but had to quickly abandon it due to the GPL issue. Due to complications with funding and grants, we can't currently open-source our project. And we will not be obtaining QT Developer's licenses for the following reasons:
1. The bureaucratic mess. A proposal would have to be written, alternatives examined, and so forth. This could take too long. This crap is the way many universities work...most software is given to us or obtained very cheaply with academic licenses.
2. Cost. $1550 goes a long ways in funding graduate students. Our research director would rather hire more students with the money saved. Even Microsoft Visual Studio, which includes far more than GUI widgets, is only a couple hundred bucks for the academic edition.
I think this is one example of why this is hurting the Linux movement. GTK is LGPL...QT should be the same. I know that TrollTech needs to pay their developers, but I sure wish someone like IBM would buy them out and LGPL QT. For something intregal to a platform, such as GUI toolkits, having to spend $1500 for a license to develop a close-source application just isn't good. Also consider small-time shareware developers. I know that shareware isn't popular in Linux, but its a way for a developer to get payed for creating that unique, niche application
Of course my arguments are based on my opinion that KDE/QT is superior to Gnome/GTK, and that if it weren't for the license issue, it would be the dominant platform today.
Correct, it's no longer available. To quote the Qt Free Edition FAQ, "Trolltech supports free software development on platforms where contributing to Free Software/Open Source development is part of the platform strategy. At the time being it does not seem natural for us to release a free edition for Qt/Windows."
Normally, I'd agree, but somehow QString always makes the things I want to do easy, whereas string makes the same thing much more painful. The same goes for Qt container classes versus STL container classes.
There is a reason for this: the Qt designers have refined these classes over the years, and were willing to abandon old aproaches that didn't work. And they have taste. The STL, on the other hand, is in some places poorly designed, and has been refined very little over the years.
Compatibility with standards is A Good Thing, but so is having a clean design.
This is so important. Some of the ... well, probably most of the C++ documentation is so complex that scares people off. Granted, the language is complex. But you can always present documentation in a friendly manner, with examples, and leave subtle points for a separate, advanced discussion. But I have the feeling that some C++ experts want to be part of an elite of a few enlightened people who know it. Too bad because it is a great language.
In this regard, Qt is a beautiful C++ toolkit, easy to use, really friendly, nicely integrated and documented. Not to mention the great RAD tools like QtDesigner ...
There was a Slashdot post a few months ago about Qt4 which stated that Qt4 was scheduled to be released in early 2004. Does the publication of this book indicate that the Qt4 release date has been pushed back? I hope not, because some of the proposed changes in Qt4 seem interesting, especially the introduction of model/view architecture for the table, list, and tree view widgets.
When you have to write cross platform applications using the compilers on HP-UX, aCC, SUN & VC then it will be years before all the template usage within Boost will work.
I wish that the C++ standard was defined in the form of a series of unit tests. That way one could just tell a compiler vendor to fix their compiler when if fails a test.
These tests should also contain code sections that should not compile according to the standard.