Slashdot Mirror


Review:Programming with Qt

ErikSev has graciously submitted a review to Mathias Kalle Dalheimer's latest O'Reilly effort Programming with Qt. For those of you interested, click below to find out more about. Programming with Qt author Matthias Kalle Dalheimer pages 361 publisher O'Reilly rating 9/10 reviewer ErikSev ISBN summary An excellent book on QT programming, and a must buy. The Scenario:

The Parrot Book, as this is sure to be known, is excellent for a beginner looking to quickly learn the ins and outs of Qt programming. Some previous experience with GUI programming helps, and previous C++ experience is required.

The Layout:

Programming with Qt starts with a chapter on Qt. It addresses freedom issues, portability issues, and other miscellaneous stuff. You then go through a basic program. The next few chapters introduce lots of different widgets and layout managers. Next come all sorts of other things like focus handling, graphics, working with perl, GUI builders, 2d transformations, etc. Look at the table of contents, it pretty much tells you what's included.

The Good:

Most of it. I personally bought this book having no previous experience with Qt, but familiar with GTK, MFC, etc. Within a day or two I was writing usable programs in Qt. This book is direct and to the point. Moreover, this is NOT just Linux users, Windows coders are definately covered, and portability is addressed extensively. GUI design, plus advanced tips and tricks are addressed. As the table of contents shows, all sorts of topics, both beginner and advanced, are covered.

The Bad:

A little too brief.just in spots. The cover of the book touts, "Covers Qt 1.4x and 2.0". I honestly feel that that is almost false advertising. Qt 2.0 is covered in a sparce 4 pages, with only two lines of code. One other nitpick, alot of lines of code are repeated, when he could just show the new/changed portions of the program. Final Thoughts:

While this book isn't a reference manual, it gets you started, and to the point where you can quickly write programs, use the more advanced features, and have the skills to find what you need in the system documentation. I do wish 2.0 were covered more, and that another unique program or two were written instead of so much code repetition. If your interested in learning Qt, and like dead trees to look at, this is a great buy. Everything you expect from a book with an animal on the cover and O'Reilly on the spine.

Pick this book up at Amazon.

Preface
1: Introduction
2: First Steps in Qt Programming
3: Learning More About Qt
4: A Guided Tour Through the Simple Widgets
5: A Guided Tour Through the Qt Dialogs
6: Using Layout Managers
7: Some Thoughts on GUI Design
8: Container Classes
9: Graphics
10: Text Processing
11: Working with Files and Directories
12: Inter-Application Communication
13: Working with Date and Time Values
14: Writing Your Own Widgets
15: Focus Handling
16: Advanced Event Handling
17: Advanced Signals and Slots
18: Debugging
19: Portability
20: Using GUI Builders
21: Qt Network Programming
22: Interfacing Qt with Other Languages and Libraries
23: Using the Visual C++ IDE for Qt Programs
24: Sample Qt Projects
25: A First Look at Qt 2.0

41 comments

  1. QT? by Anonymous Coward · · Score: 0

    Please excuse my ignorance but I've previously associated QT with QuickTime. Somehow I dont think that is what is being discussed here...
    Could someone please fill me in on what QT is?

    1. Re:QT? by Anonymous Coward · · Score: 0

      QT is the toolkit that KDE uses

    2. Re:QT? by gavinhall · · Score: 1

      Posted by King Kludge:

      The Troll Tech C++ based QT GUI toolkit, available for Linux, Win32, and used as the backbone of KDE. Check the home page at
      http://www.troll.no/

      Ciao.

    3. Re:QT? by Jonathan+C.+Patschke · · Score: 1

      QT is a "GUI Toolkit" produced by a company called Troll Tech. A GUI Toolkit is a library that contains a framework for developing graphical applications. This prevents programmers from having to reinvent the wheel, so to speak, whenever a programmer needs to create a scrollbar in his/her application. QT is written in C++ and has the benefits that it's free for Open SourceTM use, has the source available, and is fairly handsome.

      QT is the foundation upon which The K Desktop Environment and QT NetHack (of arguably greater importance) are built.


      The following sentence is true.
      The previous sentence is false.
      --
      Pining for the days when The Glorious MEEPT!!! graced SlapDash with his wisdom.
  2. It's a cross-platform GUI library by Anonymous Coward · · Score: 0

    And the basis for the Unix K Desktop Environment. Take a look at www.troll.no for Qt and www.kde.org for KDE.

  3. yes and no by Anonymous Coward · · Score: 0

    The only reason this book couldn't possibly cover all the issues in the API is that it's too short. I'd gladly pay more money to have a more comprehensive book, something on the order of the order of O'Reilly's Java Swing book (for Java 1.2) for example.

    The latter has a tutorial for every significant Java UI widget, something that's very valuable especially for the more complex ones. I was hoping the Qt book would be similar, oh well.

  4. Re:Just started it... how accurate is it by Anonymous Coward · · Score: 0

    Wow I completely missed that one. I thought I had found a few problems with it before but that is a doozy. It may still work though. It doesn't make much sense.

    It should be legal the other way around.

    QWidget * myLcdNum = new QLCDNumber (1, mywidget);

    since QLCDNumber inherits from QWidget.

    Correct me if I am wrong.

    dleimbac@falcon.lhup.edu

    Dave

  5. GTK-- is no good by Anonymous Coward · · Score: 0

    Even the GTK-- authors have said this (http://features.linuxtoday.com/stories/6298.html) . Depsite all the hype if you want to do *real* Gnome programming you have to use C. KDE is the only desktop that can really use an object oriented language of any kind.

    Don't listen to the Miguel rhetoric, it has no basis in reality ;-)

    1. Re:GTK-- is no good by mill · · Score: 1

      Put down that crack pipe.

      Guillame pointed out problems with language wrappers in general. Mainly maintenance problems. He said nothing about how good or bad Gtk-- is. In fact Ken Nelson often refers to libsig++, the signal framework of Gtk--, as the most advanced out there (no need for moc like hacks if I understood it correctly).

      /mill - which found the Mico/STL thread on kde-devel hilarious and oh so suiting

    2. Re:GTK-- is no good by AMK · · Score: 1

      KDE the only one that supports OO languages? Hardly -- the GTk/GNOME module for Python is well-maintained and quite good. A Python Qt/KDE module exists, and is also pretty good, though all the glue code required for Qt -- C++, remember -- results in an extension module that's a startling 5Mb large. (They're working on reducing the code size.) The GNOME modules add up to around 2Mb in all. So it's quite possible to write programs for either toolkit in Python, though documentation is still scarce.

  6. The Python KDE bindings include Corba and KOffice by Anonymous Coward · · Score: 0

    That is why the interpreter is so large. Where is the Gnome Office Python bindings? Opps, I forgot. Gnome has none.

  7. wxWindows is scary compared to Qt by Anonymous Coward · · Score: 0

    It's event stuff is crap. Qt is much nicer. What is people's hangup with Gtk oriented stuff. KDE/Qt has a larger user base and if you are a C++ coder it has a much nicer API. They did an excellent job. Just look at the QT tutorials at www.troll.no.

  8. Er, because Gnome people like C at C++ has Qt/KDE by Anonymous Coward · · Score: 0

    Why rewrite GTK+ in C++. A lot of C programmers like it? For C++ we have Qt and KDE. Both desktops made explicit choices as far as the primary language goes, and Gnome choose not to use an object oriented one. That's fine.

  9. Excuse my spelling and grammar errors by Anonymous Coward · · Score: 0

    It's getting rather late in my timezone ;-)

  10. Any online Version? by Anonymous Coward · · Score: 0

    hmmm... I think O'Reilly is FOR the
    OSS movement.

  11. Slightly disagreeing by Anonymous Coward · · Score: 1

    I have to disagree a bit with this review. I have used the book and while it does start off really well, I find that the best source for learning QT is still the HTML tutorial that comes with it. This small book couldn't possibly address all the issues in the API but does offer some good examples. If you want to learn QT quickly and get off the ground I would still get this book but since the documentation of QT is already pretty awesome I would say it isn't necessary.

  12. Testing by Hemos · · Score: 1

    Is it just that no one is posting to this? Or have I found a bug?

    --
    Yeah, I'm that guy.
    1. Re:Testing by for(;;); · · Score: 0

      I'm a normal user, let's see if this gets posted...

      Delete me when you get this figured out...

      --

      "Whatever happened to fair use?"
      -- Duff-Man
  13. alternative interpretation by kip3f · · Score: 1
    : It's worth noting that G, A, T, and C are the
    : four symbols in your DNA.
    :
    : There is no I.

    When I first looked at this comment, I noticed that GCAT are not themselves part of your DNA, but merely represent the molecules that do constitute your DNA. Thats when the other meaning of the second sentence hit me. (Insert Hofstadter (The Mind's Eye/GEB) and Dawkins (The Selfish Gene) blather here)
    --
    Man is most nearly himself when he achieves the seriousness of a child at play.

    --
    ****Gfx Scrollbar Special case hit!!*****
  14. Re:qt, what is there for Gnome? by Zachary+Kessin · · Score: 1

    Try these sites:

    www.gnome.org

    www.gtk.org

    --
    Erlang Developer and podcaster
  15. It's GATTACA by SEGV · · Score: 0

    It's worth noting that G, A, T, and C are the four symbols in your DNA.

    There is no I.

    --

    --
    Marc A. Lepage
    Software Developer
  16. Re:I agree by AMK · · Score: 1
    I also read this book recently, and my capsule review was:
    An introduction to writing GUI programs using the Qt toolkit. The book is almost exactly what I want from a programming book; it gives enough background to get started and to understand the reference documentation, but doesn't lose itself in trivia. Nor does it lose itself in dozens of pages of code; there are only a few examples, and none of inordinate length.

    IMHO that's precisely what a good book should do; give you enough of a grounding to understand and use the documentation and source code. Don't bury me in hundreds of pages of code; don't duplicate the on-line documentation; do cover the basic design ideas underlying the topic.

  17. Re: Parrot book... by Jeremiah · · Score: 1

    I believe the parrot book was "Lingo in a Nutshell," off the top of my head. Could be wrong.

  18. Try wxWindows for GTK by IGnatius+T+Foobar · · Score: 1

    If you'd like to write GTK apps using C++, you might want to try the GTK version of wxWindows. It has a very sensible set of object-oriented bindings, and you get the added bonus of having your program be reasonably portable to Motif, Mac, and Windoze.

    --
    Tired of FB/Google censorship? Visit UNCENSORED!
  19. Just started it... how accurate is it by MeerCat · · Score: 1

    Why is it every time I start a book, slashdot posts a review and I lose the urge to continue ?

    But anyway, I was wondering about errors, eg page 27, line 22 of the code
    QLCDNumber * mylcdnum = new QWidget(1,mywidget);
    surely this should be "new QLCDNumber(...)" (see the rest of the code). Is this an isolated instance, or does it continue ?

    As for the "diehard MFC programmers, do they exist" comment of one of the replies, yes, unfortunately they do exist, legions of them. I wrote my first C++ Windows wrapper layer in 1990, before MS released a C++ compiler, and I've refused to use that brain-dead excuse for a class library since. But unfortunately all those superb VB programmers out in the world want to progress, and MFC lets them write VB-quality code in C++ (The horror, the horror...).

    --
    I spent a lot of money on booze, birds and fast cars. The rest I just squandered. - George Best
  20. Oops by ErikSev · · Score: 1

    I stand corrected :) I am unfortunately not a biology expert. Oops.

  21. Re:qt, what is there for Gnome? by ErikSev · · Score: 1

    Yep, actually from what I've seen the book looks pretty good. Therre's a /. review of it somewhere.

    Erik

  22. Re:qt, what is there for Gnome? by hwestiii · · Score: 1

    I've seen a book from New Rider's Press on Programming with the GTK Toolkit (or something like that). I can't comment on it, however, as I've only just picked it up and skimmed, but I do know that it exists.

  23. Easy to hack by mathematician · · Score: 1

    I'm not a real programmer, but I do on occassion look into other peoples code and try to make it do something a little different. Recently I tried to look at code for text editors, and I found the source for kedit (part of KDE) a joy to look at and very easy to modify.

    I also did the same with kmines, changing minesweeper so that it does a few more fun things.

    I did this with no training in C++ (I know only C), and certainly no knowledge of Qt.

  24. Re:qt, what is there for Gnome? by JamesHenstridge · · Score: 1

    There is the GTK+ reference documentation project for documentation on the underlying GUI toolkit, and you can go to the GNOME website for documentation on GNOME. There is a revamped GNOME developer web site in development, so this resource will also be available soon.

  25. OOP by Kris+Warkentin · · Score: 1

    That's the joy of object oriented programming.... code that is easy to read and maintain. You take a bit of a performance hit but with todays faster machines, it's worth it...(IMHO). I think that this is why KDE has generally advanced faster than Gnome which is mostly done in C.

    --

    In Soviet Russia, hot grits put YOU down THEIR pants.
    1. Re:OOP by tialaramex · · Score: 1

      I won't address the KDE vs Gnome thing for the 100th time. Since this is about a Qt book though, I will say this:

      C++ is a nasty hack. I learnt it, I used it, I got tired of it, and I'm still writing C, Scheme and Java. The limitations of C++ are demonstrated by the inclusion of "moc" in Qt. Since when did I need language extensions to program a GUI? The only other toolkit I'm familiar with that does this is... MFC, which is also based on C++

      Maybe I jump to conclusions too easily, but I think C++ is a poor choice of language for an ostensibly platform-independent GUI. The language is still very immature, and doesn't even show OO techniques very well.

      If you're determined that OO design is "it" then check out GTK+ _and_ Qt before you decide on one or the other based solely on the rhetoric of this book or the Trolls. If you're determined to use C++, check out GTK-- too.

      Disclaimer: I've used GTK+ since 1997

  26. qt, what is there for Gnome? by IceFox · · Score: 1

    Ilearned Qt a few weeks ago to start programming in KDE. So my question is what do I use if I want to not use Qt? (the Gnome ver) Do you have any links? Good tutorials? Curius minds wish to know

    Benjamin

    --
    Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
  27. Ack! by Quigley · · Score: 1

    Isn't it the TOUCAN book, not the parrot book? :)

    Other than that, maybe I'll go buy it. I've been tossing around the idea, and with this B&N coupon I've been saving for a rainy day...

  28. Great book by Arandir · · Score: 1

    I think it's a great book. My two disappointments are 1) it wasn't bigger, and 2) it only skimmed the surface. When discussing a topic, it only gave examples for "typical" uses. I wanted to know about the atypical uses of certain classes, like all the ins and outs of QWidgetStack, etc.

    I've found Qt programming to be a joy. I've been porting over an MFC program of mine to Qt, and I still marvel at the stupid stuff you have to do with MFC.

    --
    A Government Is a Body of People, Usually Notably Ungoverned
  29. Re:OOP? Do you REALLY know C++? by JohnnyCannuk · · Score: 1

    If you did, you would remember that C++ is a superset of the old C and includes most of it. Language extensions? In MFC? Well this once again shows your ignorance. MFC is a (poor) set of class libraries/class wrappers for the Win32 API (written in your precious C, I beleive) and NOT an extension to the language. I can write perfectly functioning Windows code in ANSI Standard C++ by carefully designing classes. No "extensions" just calls to class libraries (GTK and QT are just class libraries/frameworks and work the same way).
    I suspect that if you had problems with C++ it was because:
    A) You only half learned it and were using C++ syntax in old C-style programming (procedural not OO).
    or
    B) You never learned proper OO techniques. I suggest a college level course or the Book "Design Patterns" by Gamma et al.

    As for your assertion that it is an immature language, well it's been around for 15+ years and is ANSI standardized...which is more than I can say for Scheme and Java (don't get me wrong, I like Java).

    BTW if you can program Java, you can program C++ .. except for Pointers in C++, they are almost identical. I don't think C++ is perfect. It could certainly use some improvments, but to call it a "hack" and to state that it doesn't do OO very well just shows ignorance. I don't like C too much, but I won't go off making half-assed remarks about it just because I don't...I know for some things it is a very good language.
    Maybe you should try to do the same.

    --
    Never by hatred has hatred been appeased, only by kindness - the Buddha
  30. I'll Just Wait for the O'Reilly Quick-Reference by opencode · · Score: 1

    I'm actually waiting for this title to arrive at Amazon (this and the book on MySQL).

    Qt is the coder's equilevelent [sp?] to the WINE Project -- open GUI code betwween platforms.

    What a wonderful segue into Linux/UNIX for those diehard MFC programmers (and I'm STILL not convinced they actually exist) !!

    --
    "He who questions training trains himself at asking questions." - The Sphinx, Mystery Men (1999)
  31. Qt not QT by nevets · · Score: 1

    It is a GUI library, used by many programs including KDE. Just like X Motif, GTK+ and MFC (for Windows).

    It's made by Troll Tech

    --
    Steven Rostedt
    -- Nevermind
  32. I agree by JimDabell · · Score: 1

    I have this book, and I have to say that it is very easy to pick up QT programming using it. This is basically the only really good learning aid for QT I have found, online or off.
    You don't really need any experience with GUI programming, though. I haven't much, and I picked things up straight away.

  33. Re:how about a full-fledged GTK++? by Blue+Neon+Head · · Score: 1

    This might be an, er, ambitious project, but what if someone just completely redesigned and built GTK+ in C++? Then all the KDE people might shut up and stop laughing at GTK--. (Nothing against KDE fans, it's just that I like GNOME while conceding its flaws.) After all, a wrapper is kind of pointless if you're going to have to download a new library for it anyway. Just release a new OO GTK+.

    ugh, I hope I didn't just volunteer myself ...

  34. Good book, bad timing re Qt 2.0 release by HarpMan · · Score: 1

    Yup, it's a good book -- I'm working my way through it right now. More elaborate examples towards the end would've been nice. Also, I hope they come out with a second edition that really covers Qt 2.0. Maybe a second volume covering more advanced stuff.

    ---------------------------------------

    --
    Stephen Molitor steve_molitor@yahoo.com