Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

C++ GUI Programming with Qt 3

timothy posted more than 10 years ago | from the works-for-kde dept.

Programming 217

william_lorenz writes: "With the recent release of KDE 3.2 and KDevelop 3.0, and with the forming of the KDE Quality team as mentioned on Slashdot just days ago, it was an opportune time to read my newest book, C++ GUI Programming with Qt 3. (Qt is of course TrollTech's multi-platform windowing toolkit -- Win32, Linux, UNIX, and the embedded space with Qt/Embedded -- upon which KDE is built. There's a free version licensed under the GPL for non-commercial use and also a commercial version.)" Read on for the rest of Lorenz' review.

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.

Conclusion

This 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.

cancel ×

217 comments

Sorry! There are no comments related to the filter you selected.

And...... the Poll of the Year.. (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8606007)

So what (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8606037)

They can have biases. It's not like this site is trying to be CNN, which BTW also has it's own biases. Get a life, if you don't like slashdot and can't filter out the biases on the site, go elsewhither for your entertainment.

FP (-1, Offtopic)

Anonymous Coward | more than 10 years ago | (#8606010)

Yehaaa!!!!

YOU FAIL IT, STUPID SHMECKLE (-1, Offtopic)

Anonymous Coward | more than 10 years ago | (#8606061)

omg roffle you are a jewish dick

Rah Rah Book Boom Ba! (-1, Troll)

ovit (246181) | more than 10 years ago | (#8606026)

TSIA

Sounds like I need it. (1, Interesting)

Trejkaz (615352) | more than 10 years ago | (#8606029)

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. :-)

Re:Sounds like I need it. (4, Informative)

abes (82351) | more than 10 years ago | (#8606132)

Python has some nice bindings [riverbankcomputing.co.uk] , and what better to go with a crossplatform toolkit than a cross platform interpreted language. Also, SIP (the tool used to create the bindings) finally works under OS X.

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 [sourceforge.net] 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 [gimp.org] and OS X [sourceforge.net] . 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 [gtkmm.org] . 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 [boost.org] , which also contains a signal library [boost.org] , not to mention a *really* nice interface to python [boost.org] (which I'm currently using in a project). Just be warned, you need a fast computer for compiling.

Re:Sounds like I need it. (3, Interesting)

Trejkaz (615352) | more than 10 years ago | (#8606211)

My current thoughts are using Qt/Java or Qt-Ruby, but it will largely depend what I decide to write.

There are also C bindings for Qt in development, if I was going for an extremely simple application I would just use those.

The #1 reason I would learn Qt, however, is to give myself a decent chance of contributing to the Psi project. I would be forced to learn C++ in that case but at least Psi's C++ is clean compared to many C++ apps I've seen. :-)

Re:Sounds like I need it. (1)

abes (82351) | more than 10 years ago | (#8606325)

It depends on what you are doing. I have meant to check out Ruby, as it sounds like a really nice language, but Python has the advantage of being more popular. This means for me that I have available libraries such as matplotlib [sourceforge.net] , and numarray [stsci.edu] , which means I can hopefully never have to use matlab again. Of course, while this is great if you are in science, if you want to write internet apps, it doesn't make much a difference.

I have never been a big fan of Java, but that's just me. I think these toolkits are great because it is easy now to write crossplatform apps easily without having to use Java. And, go ahead and flame me, but I don't consider TK a usable interface for most modern day apps.

Some reasons to use an OS' native toolkit (5, Interesting)

Rascasse (719300) | more than 10 years ago | (#8606295)

Speaking as a relatively new Mac OS X user, I'd like to add the following reasons not to try to use cross-platform GUI toolkits. Looks are deceiving. Though they appear to look like native widgets, upon closer inspection some differences become apparent. Moreover, they may not act like native widgets. The keyboard shortcut equivalents may be different than what are available on the native OS' widgets. Scripting support may be available on the native OS' widgets, but unavailable on these cross-platform widgets. As minor as these differences may appear at first-glance, they add enough inconsistency to ruin the user experience - especially on OSes such as Mac OS X.

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.

Re:Some reasons to use an OS' native toolkit (2, Interesting)

Trejkaz (615352) | more than 10 years ago | (#8606332)

The thing is, on a whole class of platforms, Qt is the "native" toolkit.

But you're right. Spell checking isn't only a problem on OSX, it's even a problem on KDE. Even if every KDE app you own uses the built-in spellchecker to check every text entry box, a Qt app you compile today will not use it automatically.

Cross-platform toolkits like wxWindows are supposed to deal with this sort of problem by just proxying the native toolkits. I'm not sure how well this works because I haven't used wx* either, mostly put off by the ugliness displayed in most screenshots from wx* apps.

Re:Sounds like I need it. (4, Insightful)

mangu (126918) | more than 10 years ago | (#8606498)

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.

Re:Sounds like I need it. (2, Informative)

illcare (635543) | more than 10 years ago | (#8606706)

wxWidgets [wxwidgets.org] is a free alternative for Qt (formerly known as wxWindows). I am currently using it and so far so good. It supports openGL, multiple languages. It is also documented quite well.

Furthermore, we discussed crossplatform GUI toolkits before here [slashdot.org] and here [slashdot.org]

Cheers,
Ilker

Re:Sounds like I need it. (1)

mrtroy (640746) | more than 10 years ago | (#8606871)

GTK is hardly a novice GUI developers dream, however. Without any premade button/listeners like swing/QT.

Just chipping in, I agree with your post

Re:Sounds like I need it. (2, Insightful)

Brandybuck (704397) | more than 10 years ago | (#8606218)

Don't igore the C++ nature of Qt! You don't need to know any of the ugly parts of the language. Qt makes C++ sensible. It's almost as if it were written by people who have to use C++ in their daily work :-)

Re:Sounds like I need it. (1, Interesting)

HuguesT (84078) | more than 10 years ago | (#8606450)

Ah yes, no template (no STL), no exception, home-grown String class and the weird non-standard signal/slot extension. C++ from ca 1990.

Ugly is in the eye of the beholder.

Stop. (0)

Anonymous Coward | more than 10 years ago | (#8606406)

The only reason to use such an API (rather than coding natively) - is cross-platform support. If you want that, use wxWidgets [wxwidgets.org] instead (because there is no GPL version of Qt for Windows).

Re:Sounds like I need it. (2, Informative)

be-fan (61476) | more than 10 years ago | (#8606523)

The PyQt bindings are dreamlike. However, C++ with Qt is pretty decent. Qt + moc makes the language a lot more dynamic and easy to use than normal, and the library does a good job of managing its own memory.

I greatly prefer Qt to Swing, though. Swing tries to be way to "pure" and as a result can be somewhat contorted.

Online Books (0, Redundant)

Tyler Eaves (344284) | more than 10 years ago | (#8606030)

Anyone know any good online books/tutorials for learning Gtk or QT?

Re:Online Books (1)

CTib (4626) | more than 10 years ago | (#8606111)

Tutorial #2 [trolltech.com]

Re:Online Books (0, Redundant)

f0rt0r (636600) | more than 10 years ago | (#8606117)

There is a short tutorial available both on Trolltech's web site http://doc.trolltech.com/3.2/tutorial.html and in the documentation that comes with the QT libraries.

Re:Online Books (1)

sn0wman3030 (618319) | more than 10 years ago | (#8606194)

I think it's best to start out with a gui designing program such as Glade for GTK+ or QT Designer for QT. They write the interface for you, streamlining the process of learning GTK/QT. There are plenty of Glade/GTK+/GNOME tutorials at developer.gnome.org. KDE has something similar on developer.kde.org as well.

Re:Online Books (1)

pyros (61399) | more than 10 years ago | (#8606811)

RAD tools are great for learning how the actual code affects the GUI. It's incredibly helpfull to start adjusting all the options in the RAD tool to see how the generated code changes. I've found that to be way more enlightening than API docs, as you can logically see how you're changing the GUI, then seeing how the code must change to reflect it. Qt Developer is a really nice tool.

WHEN WILL YOU TEABAGGERS GET IT?? (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8606038)

william_lorenz is JON KATZ. Jon Katz posts all these stupid book reviews... even though he doesn't read beyond a 2nd grade level.

william_lorenz = honestpuck = JON KATZ!!

FUCK OFF AND DIE KATZ!!!

Re:WHEN WILL YOU TEABAGGERS GET IT?? (1, Funny)

Anonymous Coward | more than 10 years ago | (#8606629)

What happened to Signal 11?

Author's review (0, Insightful)

gmuslera (3436) | more than 10 years ago | (#8606053)

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.

Re:Author's review (1)

110010001000 (697113) | more than 10 years ago | (#8606118)

Er yeah, except the reviewer isn't the author. When he said "my new book" he did mean he wrote it.

Re:Author's review (1)

110010001000 (697113) | more than 10 years ago | (#8606156)

er, I shoulda said he "didn't mean" he wrote it. Confused yet?

Re:Author's review (0)

Anonymous Coward | more than 10 years ago | (#8606621)

about what? can you be less specific?

Simplify, simplify! (-1)

Anonymous Coward | more than 10 years ago | (#8606056)

I don't have much Qt development experience (none at all yet)

IOW: I don't have any Qt development experience.

Why to get this book (4, Informative)

f0rt0r (636600) | more than 10 years ago | (#8606090)

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?

online tutorials (2, Informative)

CTib (4626) | more than 10 years ago | (#8606098)

Tutorial #2 [trolltech.com]

What you really, really should do... (2, Interesting)

Dog and Pony (521538) | more than 10 years ago | (#8606470)

... is give these guys a hand up: QT 3 Win32 [sourceforge.net] - this project would be totally awesome would it be done!

Re:Why to get this book (5, Informative)

Bruce Perens (3872) | more than 10 years ago | (#8606812)

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?

Yes. It's the Open Content License. It applies to the printed version today, meaning that you can shove it in a copier if you want and sell the copy, and it will apply to the electronic version when that is released. We usually do that about 3 months after the books reach store shelves. Source and unencrypted PDF will be available as usual.

Unfortunately, I can't say the same for the CD. There is some proprietary software on the CD, I think a Windows version of Qt and some Borland stuff, which isn't really in line with the series policy. But I found out so late that it would have seriously messed things up for the Trolltech folks for me to insist on changes, so I let that go by this time (and made sure it would not happen again).

Next books: Understanding the Linux Virtual Memory Manager [informit.com] next month, and Samba 3 by Example [informit.com] next week! Those are books 9 and 10 in the series.

Thanks

Bruce

Pricing (3, Insightful)

DRUNK_BEAR (645868) | more than 10 years ago | (#8606110)

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?

Re:Pricing (0)

Anonymous Coward | more than 10 years ago | (#8606126)

Yes. Qt. Unless GPL isn't open source to you, and if not, then you've really limited your options.

Re:Pricing (2)

DRUNK_BEAR (645868) | more than 10 years ago | (#8606190)

Sorry... Not fully awake tonight... Skipped directly over the GPL comment...

Re:Pricing (2, Informative)

BiggerIsBetter (682164) | more than 10 years ago | (#8606301)

No, it's a fair question. There is still no [trolltech.com] free GPL Windows version. Possibly closest thing to an open source option is wxWidgets [wxwidgets.org] .

Re:Pricing (1)

yamla (136560) | more than 10 years ago | (#8606529)

There may be no GPL'ed Windows version but there is a non-commercial edition of Qt 3.x for Windows included on the CD accompanying the book.

Re:Pricing (1)

Brandybuck (704397) | more than 10 years ago | (#8606228)

Go price out the "Deluxe" GNU distribution...

Re:Pricing (0)

Anonymous Coward | more than 10 years ago | (#8606504)

wxWidgets [wxwidgets.org] .

Because they don't charge you if you decided to make commercial applications.

Re:Pricing (3, Informative)

Cthefuture (665326) | more than 10 years ago | (#8606632)

Yeah but wxWidgets (wxWindows) is kinda crappy.

It's layers on layers of API's which just multiplies the complexity, amplifies bugs, and slows things down. Not to mention the bloat on bloat.

Plus it's not really very cross platform, there are so many "This works on Gtk but not Windows" or "This works on Windows but not anything else", etc. Your code turns into #ifdef spaghetti hell. You might as well write native versions for each platform.

The only truely viable cross platform (X11, Windows, MacOS) toolkits are:

1. Qt (*too expensive, nice API, kinda bloated/slow)

2. Fltk (tight/fast, nice API, *limited power, ugly/no themes yet)... My current favorite but I have a lot of custom code to make it look good and add features I need.

3. Tk (*horrible API, not very flexible, can be slow)... I haven't used it much because the API sucks. Does this run under an X11 layer or native on MacOS?

4. Gtk (C based painful API or Gtkmm C++ bloat, kinda bloated but relatively fast on X11, slow on Windows, MacOS uses X11 layer, *buggy as hell)

It can be more than that. (0)

Anonymous Coward | more than 10 years ago | (#8606841)

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.

GPL Version (4, Interesting)

bfree (113420) | more than 10 years ago | (#8606115)

Quoting from the submission:
There's a free version licensed under the GPL for non-commercial use
Pardon? How can a GPL be version be restricted like that? Of course it can be used commercially, just under the terms of the GPL.

Re:GPL Version (2, Informative)

denks (717389) | more than 10 years ago | (#8606220)

Take a look at MySQL [mysql.com] to see how something can be offered both commercially and under the GPL.

If you are the copyright holder for the entire code, you can license it however you please. The GPL does not remove the right of the copyright holder to do whatever they want with their own code

Re:GPL Version (2, Informative)

bfree (113420) | more than 10 years ago | (#8606293)

A copyright holder can license it however they please, but if they license it under the GPL that's that. They could license it under a modified GPL which doesn't allow commercial distribution but I didn't think that was the case here! GTK on the other hand is under a modifed LGPL which allows derived binary only releases.

Re:GPL Version (1)

denks (717389) | more than 10 years ago | (#8606520)

Apologies, I didnt read the parent post closely enough. Yes, once code is under the GPL you cannot decide that it only be used for commercial or non-commercial use. My point was misdirected.

Re:GPL Version (1, Interesting)

Trejkaz (615352) | more than 10 years ago | (#8606274)

The holders of the copyright can decide which license applies to which parties. Trolltech have simply decided that commercial parties need to pay them money to use it, while everyone else can use the GPL.

Re:GPL Version (1)

Robawesome (660673) | more than 10 years ago | (#8606399)

Trolltech have simply decided that commercial parties need to pay them money to use it, while everyone else can use the GPL.

This is crap. The GPL explicitly allows charging for distribution. Unless by commercial you mean "Restrictive of users' freedom", in which case you are right.

Re:GPL Version (1)

Trejkaz (615352) | more than 10 years ago | (#8606511)

How would I know? "Commercial" is Trolltech's wording, not mine.

Re:GPL Version (2)

GlassHeart (579618) | more than 10 years ago | (#8606412)

The holders of the copyright can decide which license applies to which parties. Trolltech have simply decided that commercial parties need to pay them money to use it, while everyone else can use the GPL.

Doesn't work that way. The GPL explicitly permits your licensee (who in this case is not a commercial entity if you refuse) to give out the source code to anybody. If you additionally require your licensees not to give it to a commercial entity (which is legal), then it's no longer GPL.

Re:GPL Version (1)

Trejkaz (615352) | more than 10 years ago | (#8606490)

Then make a commercial app based on Qt, sell it for a big profit, and see if Trolltech brush it off.

Re:GPL Version (1)

mark-t (151149) | more than 10 years ago | (#8606774)

Here's the thing though.... it's entirely possible to make a Qt application without actually linking statically or dynamically to any of Trolltech's code, but instead just using interprocess communication.

The GPL isn't sustainable through IPC because if it were, Photoshop would be violating the GPL because it can read picture files that were created with the Gimp, for example.

Re:GPL Version (0)

Anonymous Coward | more than 10 years ago | (#8606501)

They sell a non-GPL version for use by those that don't want to GPL their entire application.

Since the GPL is viral, I like to look at a commercial co-license as a condom for protecting your work.

Re:GPL Version (1)

be-fan (61476) | more than 10 years ago | (#8606639)

I think you're misunderstanding how the TT license works. Since Qt is GPL'ed, you're right, they can distribute it however they want. However, if you want to write a proprietory app using the library, you'll have to use a GPL-compatible license for your work. If you don't want to do that, you can pay Trolltech to license it to you under the terms of a non-GPL license.

Re:GPL Version (2)

alienw (585907) | more than 10 years ago | (#8606467)

Wrong. First, you can't do that (with the GPL anyway). Second, you can perfectly damn well use Qt for commercial applications. You just have to license your commercial application under the GPL, thus making it Free software.

Re:GPL Version (1)

Trejkaz (615352) | more than 10 years ago | (#8606563)

... and then by Trolltech's definition it isn't a commercial application anyway.

Re:GPL Version (5, Informative)

HuguesT (84078) | more than 10 years ago | (#8606284)

What they mean like that is that you are not allowed to develop closed source apps, free (as in beer) or otherwise, with the GPL version of QT.

If you want to develop closed-source applications with QT you need to purchase the commercial version of QT, you can't use the GPL version.

This way of doing things is compatible with the GPL.

Re:GPL Version (4, Informative)

bfree (113420) | more than 10 years ago | (#8606338)

Right, so the original post should have read something like "There's a free version licensed under the GPL and also a commercial version for when that isn't appropriate" not that there is a GPL version for non-commercial use.

Re:GPL Version (1, Informative)

Anonymous Coward | more than 10 years ago | (#8606516)

Someone moderate this post up, this guy actually 'gets it'.

To further clarify. You can use the GPL version of Qt for commercial purposes, but if you sell a product that uses the GPL version of Qt your product has to be GPLed. Doesn't mean you can't sell your product, just means you can't restrict what users can do beyond the GPL and you have to provide source code, so your customers can give it, or your source code away under the GPL. However, since TrollTech also offers a non-GPL license option, if you don't want to abide by the GPL and want to sell a closed source commercial product using Qt, you can do that if you pay TrollTech for their 'commercial version'.

Also note that TrollTech does not offer a GPL version of their Windows version of Qt, that one is commercial only. Only the *nix version is GPL. Although TrollTech discourages anyone from doing so, there is legally nothing TrollTech can do to stop someone from porting the *nix version to work on Windows, the GPL specifically permits that. I believe that TrollTech might be able to legitimately require any such derivative work to change the name of the result or otherwise sufficiently distinguish that it is not a TrollTech developed and supported port. Someone correct that if its wrong. And of course such a port couldn't be sold under a closed source license the way that TrollTech sells their non-free Windows Qt.

Re:GPL Version (1)

yamla (136560) | more than 10 years ago | (#8606547)

There's a version included with the book that is fine for non-commercial use. While the license isn't GPL, it certainly isn't 'commercial-only' as you say.

wow! we are at the python/java/.NET era! (4, Funny)

borgdows (599861) | more than 10 years ago | (#8606124)


programming GUI in C++... it's so nineties!! :o)

Re:wow! we are at the python/java/.NET era! (0, Offtopic)

Oestergaard (3005) | more than 10 years ago | (#8606161)

Ok, something like this was bound to happen ;)

C++ bashers out there, please go read a short C++ vs. C [unthought.net] "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).

Re:wow! we are at the python/java/.NET era! (3, Insightful)

abes (82351) | more than 10 years ago | (#8606261)

I love C++. However, I constantly run into the problem that almost no one else in my field (science) understands C++. Some know C and matlab, but that's about the end of it.

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.

Re:wow! we are at the python/java/.NET era! (0)

Anonymous Coward | more than 10 years ago | (#8606557)

What ?

Qt does use templates rather extensively.

http://www.warmi.net/docs/qt_3_0_5/tools.html

Re:wow! we are at the python/java/.NET era! (0)

Anonymous Coward | more than 10 years ago | (#8606692)

Take a gander at the subject of the post...

Download? (0, Offtopic)

110010001000 (697113) | more than 10 years ago | (#8606174)

Anyone know where I can download it?

The great thing with Qt: Write once,... (4, Funny)

hysterion (231229) | more than 10 years ago | (#8606229)


...review everywhere! [slashdot.org]

C++ Skill... (3, Interesting)

MP3Chuck (652277) | more than 10 years ago | (#8606238)

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.

Re:C++ Skill... (4, Informative)

Otter (3800) | more than 10 years ago | (#8606303)

Qt (or maybe Qt+KDE) is *the* place to start!

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.

Re:C++ Skill... (3, Informative)

Quattro Vezina (714892) | more than 10 years ago | (#8606447)

and maybe then trying KDevelop and the KDE libraries.

Actually, I'd recommend that if he has KDevelop 3, he should use it to create a new Qt app--specifically, the one with the menus/toolbars/text editor. Why? It'll generate a good amount of code, specifically, it'll create a bare-bones text editor. He can then look through the code, compile and run the app, and see how it works, then playing around with it and making changes, seeing how those changes affect the app.

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.

I fully agree with you here. Add Qt Designer to the mix as well--it'll really help with interface design. Though I would still recommend learning how to create widgets without Qt Designer first, in order to better learn how they work. After learning that, he should then use Qt Designer to set up the design of his apps.

Re:C++ Skill... (1)

MP3Chuck (652277) | more than 10 years ago | (#8606741)

So I'm guessing it'd be easier to learn/develop Qt in a Linux environment, as opposed to Windows? KDevelop is obviously a KDE tool, and I don't see QtDesigner download available on TrollTech.

It's not a big deal to have to use Linux... but Windows would be more convenient, since that's where I am most of the time.

Re:C++ Skill... (1)

120duff978 (762910) | more than 10 years ago | (#8606318)

Just basic OO stuff really. Qt isn't heavily templated, so the part of C++ that gives most people a headache isn't there. It's nothing more tricky than what you'd see in the STL.

Re:C++ Skill... (1)

Quattro Vezina (714892) | more than 10 years ago | (#8606384)

I'd say you're probably ready. I've just started dabbling in Qt now, and that's after taking a year of AP C++ in high school, and a semester of C++ in college, plus some self-study.

You might want to check out Trolltech's documentation site [trolltech.com] . Particularly, the How to Learn Qt [trolltech.com] , The Qt Whitepaper [trolltech.com] , Tutorial 1 [trolltech.com] , and Examples [trolltech.com]

Tutorial 1 is easy to follow, and should give you an idea of how things are done in Qt. The Whitepaper is a more general overview of Qt. Those should help you get started, and will let you determine if you're ready to delve into GUI.

Re:C++ Skill... (1)

alienw (585907) | more than 10 years ago | (#8606481)

Not too much. You have to understand how classes and such work pretty well, but you can do many simple applications quite easily. Try the Qt Designer tutorial series (doc.trolltech.com)

Re:C++ Skill... (0)

Anonymous Coward | more than 10 years ago | (#8606714)

Tangible? I guess by that you must mean "clickable".

Re:C++ Skill... (1)

Snoopy77 (229731) | more than 10 years ago | (#8606777)

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.

I'm guessing that you would have a basic understanding of most of the features of C++ and would understand the philosophy of OOP. The major step is now getting out of a command line user input/system output frame of mind to a GUI one. But starting with a mature toolkit like Qt is a great place to start.

Gah! Kill Qt already! (1, Informative)

Anonymous Coward | more than 10 years ago | (#8606287)

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.com] .

Trolltech charges $2400 [trolltech.com] 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 [newegg.com] ) - and they even give away a free version of their compiler [microsoft.com] .

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 [wxwidgets.org] as a thoroughly competent, cross-platform, commerce-friendly GUI system.

Re:Gah! Kill Qt already! (1, Informative)

Anonymous Coward | more than 10 years ago | (#8606367)

$2400 is absolutely nothing to pay for a decent toolkit.

I've looked at libraries - imaging in particular where they charge you $200 just to get an evaluation copy.

If you want to make money from your software, but can't afford to put up $2400 then you might as well give up now, or try a GPL release - you'd be suprised how many people would still buy it.

Re:Gah! Kill Qt already! (0)

Anonymous Coward | more than 10 years ago | (#8606479)

How the f*ck is this flamebait? Wake up moderators!

Just the way it is. (0)

Anonymous Coward | more than 10 years ago | (#8606795)

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.

/s/non-commercial/non-proprietary (4, Informative)

abe ferlman (205607) | more than 10 years ago | (#8606312)

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.

Re:/s/non-commercial/non-proprietary (1)

Buck2 (50253) | more than 10 years ago | (#8606565)

that's what precision and accuracy are all about

Re:/s/non-commercial/non-proprietary (1)

be-fan (61476) | more than 10 years ago | (#8606611)

(with-french-accent (say "Accuracy and precision!"))

Re:/s/non-commercial/non-proprietary (0)

Anonymous Coward | more than 10 years ago | (#8606705)

It can't be sold commerically though. Well, it can, but you can't limit redistribution which pretty much kills the whole point of selling it.

Even if you don't mind open-sourcing your application for sale it still won't work.

BAG FUCK A HAIRPIECE RUMBA CANOPY!!!! (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8606356)

Somewhat OT: Something smaller than Qt3? (2, Interesting)

rthille (8526) | more than 10 years ago | (#8606379)

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.

Re:Somewhat OT: Something smaller than Qt3? (1, Interesting)

Anonymous Coward | more than 10 years ago | (#8606725)

Fltk [fltk.org] is what you want. Qt's pricing sucks ass anyway.

How does Qt programming compare with Gnustep? (2, Interesting)

Lord of the Fries (132154) | more than 10 years ago | (#8606420)

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?

Qt is not my favorite toolkit (0, Interesting)

Anonymous Coward | more than 10 years ago | (#8606432)

I'm posting anonymously for obvious reasons.

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.

  1. Object orientation as a language prescription is a bad idea: At the time, every other GUI programming method used messages. From Xlib through to Win32, all GUI programming methods use messages. 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.
  2. Object orientation brings bloat: often students would go way overboard in designing a solution, using 30 classes where 5 would suffice. At the end of the course, I wanted to take my bat object and call bash on their skull object.
  3. Compilers are not good at OO: compared to C, C++ compilers are immature and buggy. Sure, this is a compiler issue not a toolkit issue, but I found it frustrating debugging student's choice of compiler rather than choice of code.

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.

Re:Qt is not my favorite toolkit (0)

Anonymous Coward | more than 10 years ago | (#8606704)

I beg to differ on point 3. There are several C++ compilers now that do a very good job of turning (well written) C++ into code that often runs faster than the same thing in (well written) C.

I hope you're not basing your assessment on compilers of 1999 (five years ago), because g++ is now a very mature C++98 compiler.

Cheers! :-)

Re:Qt is not my favorite toolkit (4, Insightful)

be-fan (61476) | more than 10 years ago | (#8606713)

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).

Re:Qt is not my favorite toolkit (0)

Anonymous Coward | more than 10 years ago | (#8606745)

Object orientation as a language prescription is a bad idea: At the time, every other GUI programming method used messages. From Xlib through to Win32, all GUI programming methods use messages. 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.

That doesn't make any sense. Why is threading an object difficult?

Object orientation brings bloat: often students would go way overboard in designing a solution, using 30 classes where 5 would suffice. At the end of the course, I wanted to take my bat object and call bash on their skull object.

You must not be a very effective teacher. Bad code can be written in any language.

Compilers are not good at OO: compared to C, C++ compilers are immature and buggy. Sure, this is a compiler issue not a toolkit issue, but I found it frustrating debugging student's choice of compiler rather than choice of code.

It's 2004 not 1994. Try a modern compiler.

Re:Qt is not my favorite toolkit (0)

Anonymous Coward | more than 10 years ago | (#8606790)

You're more likely posting it anonymously because you are a troll, no ?

Disclaimer: I'm not a fan of C++, yet I know its advantages and if I want to use it for a project -- or not. Qt is actually a rather nice GUI framework (thanks to signals/slots !), with in fact many similarities to the NeXSTEP framework. Qt got nice characteristics: it's mature, cross-platform, and it's quite easy to write applications for it.

Your #1 comment isn't that relevant with Qt -- it could be with other OO toolkits. Your #2 is half-true; yes, students tends to make design errors -- after all, they ARE students ! But OO gaves you a much better design when you had practiced a bit, I really don't know anybody that could argue the contrary. #3 ... well, #3 is also half-true. Sure, C++ compilers are more complicated. But frankly, thoses #2/#3 comments seems to come directly from 1992 !!!

In any cases, for the record, my preference won't go to C++/Qt -- NO. But simply to Objective-C/OpenStep, that is, either GNUstep [gnustep.org] implementation (crossplatform) or Cocoa [apple.com] implementation (Apple, OSX, directly from NeXT).

Yet, Qt is a good toolkit, and depending of the work/platform, it could be my choice (well... at least until GNUstep catch up on win32... which could be not that far !)

Re:Qt is not my favorite toolkit (5, Insightful)

Gauchito (657370) | more than 10 years ago | (#8606845)

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.

...and C++ is not my favorite language (0, Flamebait)

Ars-Fartsica (166957) | more than 10 years ago | (#8606847)

Never was there a language so misused, so misunderstood. Never has a tool given developers so much rope to hang themselves with...in fact perversely designed to make the dnager outweigh the benefits for most designers.

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++.

Yummy Yummy (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8606456)

Cummy Cunt

Where's VB for unix (4, Interesting)

superpulpsicle (533373) | more than 10 years ago | (#8606483)

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?
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>