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.
I've been considering getting into native GUI development for a while now and Qt seems like as good a way as any to enter. The API is about as clean as Java's Swing, and I can hopefully ignore the C++ nature of it for the most part by finding a binding to something else. :-)
Karma: It's all a bunch of tree-huggin' hippy crap!
Anyone know any good online books/tutorials for learning Gtk or QT?
TODO: Something witty here...
It could be an excellent book, and an excellent and very objective review, but, well, by default i would trust more in thirdy party reviews.
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!
Tutorial #2
Qt may be nice and cool since it's multiplatform, but the pricetag associated with it is not so nice and cool (starting at 1.55k$). Is anyone aware of OSS products similar to this?
DrkBr
Never underestimate the dark side of the Source
programming GUI in C++... it's so nineties!!
Ok, something like this was bound to happen ;)
C++ bashers out there, please go read a short C++ vs. C "competition" sort-of.
It's a short explanation of some of the most common C++ vs. C misconceptions, and a funny little benchmarks (with a lot other than just hard numbers).
Anyone know where I can download it?
...review everywhere!
Timeo idiotikOS et dona ferentes
What level of C++ knowledge is necessary to begin working with something like Qt (or other windowing libraries for that matter)? Having taken several semesters of C++ so far, I want to try something a little more tangible than the prompt stuff we've been doing.
Who doesn't like free music?
While for software engineers you might be able to argue that its their field, learn the language, you can't do that with people who use programming as part of their job, but not their main focus. I am constantly faced with the problem of either having other people understand my code, or writing things faster and with less bugs.
The biggest obstacle is the difficult syntax of C++. After using it for enough time it's easy to forget, but it is a rather large learning curve -- especially for people who just want their code to work. The other complaints leveled at C++ (unless you are working with embedded systems, etc.) I think are just flamewar material.
If there was one feature to pick out for why to use C++ I would have to say templates. Too bad toolkits like QT don't use them.
Qt's licencing is absolutely abysmal. You can't make commercial products with it for free - even if you don't change or add to their code and are merely linking with it. Oh, and there is no GPL version for Windows .
Trolltech charges $2400 for two platforms. Presumably cross-platform coding is the sole reason you'd be using such a GUI library - so that's going to be your base price.
But Microsoft solutions are far cheaper (it's less than $100 for Windows XP from NewEgg) - and they even give away a free version of their compiler.
If you're looking for a cross-platform GUI - for a commercial or free project - look at the competitors to Qt. I would not hesitate to recommend wxWidgets as a thoroughly competent, cross-platform, commerce-friendly GUI system.
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.
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...
From the FAQ:
Qt/Embedded can be configured to for ROM requirements between 800k and 3M, depending on what features are enabled.
I'm working on a new software load for the Ceiva (ver 2), and 800k ROM just for the graphics is way to heavyweight.
Awesome furniture, accessories and cabinetry in Santa Rosa, CA: http://humanity-home.com/
The only reason to use such an API (rather than coding natively) - is cross-platform support. If you want that, use wxWidgets instead (because there is no GPL version of Qt for Windows).
I've done a little Gnustep programming... is there anyone who's done both who can give a comparison? Would I be happier doing Qt?
One man's pink plane is another man's blue plane.
I'm a Teaching Fellow (TF) at Harvard, and I am involved in teaching programming usable interfaces to students, and setting them assignments.
Back in 1999, when Qt was the only toolkit of note, I suggested that an assignment in Qt would be in order. I underestimated the grief that this would bring me.
Thankfully, the GTK+ toolkit is winning the battle of the GUI toolkits. 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.
... is give these guys a hand up: QT 3 Win32- this project would be totally awesome would it be done!
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?
What ?
Qt does use templates rather extensively.
http://www.warmi.net/docs/qt_3_0_5/tools.html
What happened to Signal 11?
Take a gander at the subject of the post...
KDE and Apple both have their zealous defenders and will not tolerate legitimate critcism. Mentioning Apple's long term friendly relationship with Microsoft and KDE/Qt/Trolltech's relationship to SCO and the Canopy group are grounds for getting scored as "trollbait". They are pretty vicious in their suppression of worthwhile discussions of the issues and any comment that is not contributing to a lovefest to KDE or Apple will get smacked.
Obviously there are some embarassing truths about Apple and KDE that they don't want to get reminded of but you're better of posting them to a Gnome or Linux story.
Try $2.5K if you want to be able to do ActiveX (Enterprise Edition).
Not to mention that it is licensed "per developer, per year".
Makes other full-blown development environments (from Borland or MSFT) look dirt cheap by comparison.
And to think people think Perl is bad - ever try reading someone else's C++?
But maybe it isn't so bad, after all C++ comes standard with a a great networking library, an awesome database access architecture, and neat security tools. Oh wait...
The best thing you can hope for in any software market is that your competitor make it a priority to code everything in C++.
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.
For those of you that do not know, there is Visual Component Framework (VCF) at vcf.sf.net. The author of VCF is in the same boat as many of you. He likes Qt very much, bud does not like the price associated with it, thus he created VCF which has the goal of working on Windows, Linux, and Mac OS X. Right now it works on Windows, parts of it work on Linux and OS X. VCF is free and has the BSD licence.
You might be in the python/java/.NET era, Bucko, but that doesn't mean the smart people are. .NET? .NET??!?? Are you kidding?
Is anyone aware of OSS products similar to this?
Gnome/GTK+ is available for Win32, although not as neatly packaged as for X11. Dropline has some Win32 packages that are easy to install. Tor Lillqvist has created some packages that a useful in conjunction with the MingGW environment. I believe that there is a Cygwin Project as well (see here but I can't testify as to its status. If you need an IDE, the Bloodshed IDE, Dev-C++, can download GTK+ packages for use within the IDE, and can help you automate integrating GTK+ in your apps. See here for information on the IDE.
Gnome/GTK+ is GPL'd and truly "free software". wxWindows is another option, but someone has already posted regarding that, so I'll leave it to you to investigate your options and decide which you like best.
The FLTK toolkit (Here) worked pretty well for me. I don't know how it compares with QT, but if you're doing basic GUI stuff, there really isn't anything missing. It is GPL for Win/Mac/Unix.
The reviewer miswrote. Must of have been confused with the Windows non-commercial (essentially a trial) version of Qt.
You can sell KDE (example: most commercial Linux distributions.) You can sell GPL Qt applications.
Nothing to see here. Move on folks.
Bruce, I checked the page for accessing the source of the books under Open Content License:
http://phptr.com/Perens
However, it seems to me the source of "The Official Samba-3 HOWTO and Reference Guide" is screwed. I downloaded the file but there's nothing there about the actual content of the book, and there are 5 missing chapters from Samba.org.
my thoughts exactly
Thanks
Bruce
Bruce Perens.
Thanks
Bruce
Bruce Perens.
There's the open QT/X11, which is GPL'd. No commercial restrictions apply.
There's QT/Windows non-commercial, which is included with the book.
There's QT/X11 & QT/Windows commercial (for making closed-source apps), which are not included with the book.
Any clearer now?
Kjella
Live today, because you never know what tomorrow brings
C++ is *the* language, complex - sure enough, misunderstood - even more sure, 90% of today's CS stuff is drawned in its own mediocricy - count on that!!! this was one of the best books on programming languages I've ever read and if you're capable of understanding 50% of it you're sure to change your opinion on the language. Oh and...
Yes, as well as C, Lisp, Java, PHP...etc. And for all those cases I found the following statement true: as long as the person who's wrote it is a <language name here> programmer and not someone *forced* to do the job in <language name here>, it will be a joy to read - in all the other cases the code readability depends on writer's & reader's intelligence.
1. No sig. 2. ???? 3. Profit!!!
Please mod down to where he belongs!
If you already know C++, then it might be a good idea to check out the Independent Qt Tutorial.s /qt_tutorial/
http://www.digitalfanatics.org/project
(but without those spaces in the URL)
Done that. Got marked "offtopic".
Still don't see how I wasn't on topic.
With an exception for static linking. Makes a big difference for commercial development, although geniuses in my company decided that even using public domain code is illegal without a "license". Think I can make a quick buck selling licenses for BSD sources and textbook examples?
And programming, generally, is ...so sixties!!! (where is my AI bot to write programs for me ?)
Don't want to give, don't take.
This is pure nonsense. More OSS use = good, even if only a tiny fraction gives back.
I don't see why some domain specific project should be open sourced - it would mostly benefit the competition of the company, while being completely worthless to the Open Source community at large.
We need lots of friends in proprietary software scene. There are lots of respectable proprietary companies out there.
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"
People are free to think so, right?
Sigh. If you can't afford the license cost your software must be pretty sucky anyway, as thats barely a couple of months wages.
$2400 buys you a lot of beer, dontcha think?
Save your wrists today - switch to Dvorak
FLTK license is LGPL with *strict* allowance of static linking to proprierary apps.
Even allowing for the weak dollar and the 17.5% sales tax the Brits enjoy (!!!), the UK pricing is simply ridiculous. I simply can't understand why the British public puts up with it. This kind of pricing is considered normal in the UK for just about everything, including food, and the public seems happy to pay.
There would be rioting in the streets if they tried British pricing in the USA. Britain is a strange place.
I've tried a lot of languages, from Basic (on C64, QBasic and Visual Basic...), C++ to Java and a few other, different toolkits (even MFC) and I've come to like C++/Qt very much. It makes C++ essentially feel like a much higher-level language.
Yet if you need to drop out of the Qt system for speed or some other reason, you can start doing your own memory allocation, pointers and whatnot. All the (ugly) power of C++, all the higher-level encapsulation of Qt, with one language syntax, one IDE (KDevelop 3 is nice btw).
As long as what you want is Linux/GPL, it's the best toolkit there is, in my opinion. You can tell by all the whiners complaining you can't use it for free for closed-source programs or on Windows...
Kjella
Live today, because you never know what tomorrow brings
The guy behind the SCO suit on Linux sits on the board of directors of Trolltech ????
Who's spreading FUD with their posts?
Who's hiding stuff?
Now, yeah, if you only have 400k then you don't want QT. You want something that's much lighter and has fewer features. But that's the nature of embedded programming and something that people who've never done it understand. You're highly constrained by the platform. Just as we were back in the day when 640k was all you had for os, code, and data on a 16 bit platform.
Best Slashdot Co
arrgh.
Best Slashdot Co
I would love to develop stuff with QT. Free stuff, hopefully useful stuff, that's just a compile away from being cross-platform. But unfortunately, there's just a leeetle fly in the ointment, one teeny-tiny reason why I cant:
Because it would cost me over $2000 just to TEST the damn thing!!!
You see, for various reasons I'm stuck on a Win32 development platform right now. I have access to Linux boxes, and I'd love an excuse to get another Mac, but for the time being I'm doing all my grunt work on Windows. So in order to actually do anything useful, I'd have to do at least the initial development under Windows. And that's gonna cost me. Sure, I could download the 30-day evaluation, but that puts a "Buy Me Dammit!" window up on every app, and stops working after 30 days. Not exactly conducive to development flow, eh? But if I want to see what it should look like, I'm out to the tune of $1500. And if I wanted to also test it on a Mac, well, that's $2500. At least there's a $500 discount for two platforms.
Hey Trolltech, if any of you are listening, may I respectfully make a suggestion?
You mention on your site that the reason the Linux versions are free and the Win32/Mac versions aren't is that you want to foster Linux development. Well, that's a nice sentiment, but you're going about it exactly the wrong way. The best way to get people to move to Linux is to give people who already use Windows really cool FREE applications that run on Windows but that also happen to run JUST THE SAME on Linux. And do the same for the Mac. That approach eliminates the major migration barrier of "but can I run my application on Linux?" Because with QT apps the answer would be "sure, no problem".
But the only way this would happen would be if the tools to create these cross-platform goodies were accessible to the legions of individuals and small groups who write them. And right now, the price tag puts the price of developing even free Windows and Mac programs out of their reach. So you're left with the ability to create really nice free stuff for Linux that the Windows and Mac users will NEVER EVER HEAR OF. They'll never get used to those free applications, they'll never get to like those free applications, they'll never ever realize that they can have their favorite free applications WITH the benefits of Linux. And that is the biggest shame of all, because it does nothing to promote Linux.
So my suggestion to you is to please Please PLEASE open up your licensing just a little to provide free Win32 and Mac toolkits, just like you do for Linux, to create non-proprietary applications. Please understand that I have no quarrel with your current (and eminently fair) prices for development kits used for proprietary applications. But PLEASE open up your toolkit to the little guy who just wants to create something to give back to the community but is stymied by the price tag.
I'm interested in trying my hand at some QT work and this review makes it seem like this book is a good start for me. My concern is QT vs GTK and how much of my experiences will be useful if I change at some point. Whats the scoop?
I'm not really interested in commercial application development - just learning.
The point is C++ introduces a ridiculous maount of complexity which its syntax does not handle very well. This is why C is still far more widely used after a decade of C++ advocacy - it is a better language for systems/library/platform development.
Once again, I wholly support any efforts by my competitors to recode in C++. In a year when they are mired in debugging hell, I will have already cashed my checks.
Anyone tried compiling the UNIX GPL'd Qt using Windows Services for UNIX 3.0? Could be an easy way to solve the Win32 GPL problem.
I dunno, I like tk, but the times I've used it I've written my GUI in tcl, with the rest of my app as tcl extensions in C. So I don't think of it as an "API", in the sense that I've never tried calling tk from C or any other language besides tcl. It is indeed a little inflexible, but easy things are very easy and hard things can be written in C. What was "horrible" about it to you?
It runs native on Windows and older versions of Mac OS, I'd have to look up whether it runs native on MacOS X.
That's rather heedless of you: you obfuscate your own email address on Slashdot but not someone else's?
Bruce
Bruce Perens.
Unfortunately, they wanted the thing in C++ (I don't know what this gained them besides bugs and the possibility of more bugs to come). The two things I learned from this experience are that PyQt is a very nice wrapper, and Python is a very good way to write C++ applications. From writing the C++ code, I learned that Qt is indeed an awesome toolkit from the vantage point of a C++ programmer, but unfortunately it is a bloated monster from the perspective of someone not lying in the gutter.
In the great CONS chain of life, you can either be the CAR or be in the CDR.