Slashdot Mirror


A Taste of Qt 4

Karma Sucks writes "In 'A Taste of Qt 4', Trolltech reveals that it is positioning Qt 4 directly against Java. Qt 4 promises to be smaller and faster than its predecessors and there will be a boatload of new features including support for non-GUI applications and accessibility under Linux using Sun's ATK. More controversial is the introduction of a new and elegant foreach construct. Incidentally, for those still opposed to Qt's moc preprocessor, Havoc has some interesting comments. It is possible the idea will be adapted to provide GObject introspection in the future."

14 of 365 comments (clear)

  1. Qt is almost a like a language by infiniti99 · · Score: 5, Informative

    In the Linux world, Qt is often thought of as just a GUI toolkit. After all, there is no look-and-feel standard in the X11 environment, and by default Qt and Gtk look much different. Therefore, most look-and-feel decisions on the X11 platform amount to selecting between the toolkits. Consider PyQt, which provides GUI support to python via Qt, but nothing more.

    What people don't realize is that Qt is actually a massive foundational library, similar in nature to Java's, for C++. It is a very large API, with threading, network, XML, objects, container classes, string handling, unicode, etc. The 'moc' tool even brings extra features to C++ that normally don't exist. It's almost as if Qt/C++ is a language of its own. GUI is a very small portion of Qt. In fact, of all the Qt code I've ever written, most of it has nothing to do with the GUI. Qt makes C++ actually fun.

    I'm very much looking forward to Qt 4. With the plans for advanced threading support and GUI/non-GUI split (similar to how glib and gtk are separated), I can see Qt being very useful for writing cross-platform server applications, a market mostly ruled by Java. The great thing about Qt is that it gives us natively compiled code.

    1. Re:Qt is almost a like a language by dcuny · · Score: 5, Informative
      What people don't realize is that Qt is actually a massive foundational library...

      Yes, a lot like wxWidgets.

    2. Re:Qt is almost a like a language by vivek7006 · · Score: 4, Informative

      You are right. QT is more than just a GUI. QT XML Module provides a very neat XML solution (both DOM and SAX), but unfortunately their implementation is really slow

    3. Re:Qt is almost a like a language by Yokaze · · Score: 4, Informative

      Only objects derived from QObject and added as a child to another QObject are deleteted automatically on destruction of the parent. (See QObject)

      This means that one doesn't have to delete all widgets which are added to a parent widgets by hand, but that it happens through the ownership-tree when deleteing the parent widget.

      I don't feel qualified to play judge between DDJ and Trolltech on wether that is good or bad C++ practice.

      --
      "Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
    4. Re:Qt is almost a like a language by StormReaver · · Score: 2, Informative

      "I don't feel qualified to play judge between DDJ and Trolltech on wether that is good or bad C++ practice."

      Like all language features, whether Qt's automatic object deletion is good or bad depends entirely on the programmer taking advantage of the feature (or failing to take advantage of it).

      I think it's a great feature. It proves its usefulness each time I create a non-trivial user interface.

      I use QPtrList (the class which does the behind-the-scenes auto-deletion) extensively in my non-GUI classes just so I can take advantage of auto-deletion. When the class goes out of scope, all its children objects are automatically destroyed.

      It's the concept of a destructor extended to be even more useful.

  2. Re:About KDE... by 10Ghz · · Score: 5, Informative

    I would say yes. There has been lots of talks in the KDE-community to keep on optimizing the code. And Qt4 has several improvements that boost performance in the toolkit-side. So the toolkit gets a significant performance-boost with Qt4, and KDE itself gets more and more performance through optimizations in the code.

    Qt4 alone should cut down the start-up time of apps significantly. It's effect in the run-time are propably less dramatic, but the KDE-folks can make a difference there (and they are making a difference). And Qt4 should eat considerably less RAM. I see good things ahead :).

    --
    Lesbian Nazi Hookers Abducted by UFOs and Forced Into Weight Loss Programs - -all next week on Town Talk.
  3. Scribe by Anonymous Coward · · Score: 1, Informative
    The new text engine, codenamed Scribe, offers a public API for high-quality Unicode word processing with real WYSIWYG.

    I hope they looked at the Swing libraries for inspiration. I've settled on Swing as the library for a big project, because I need to change the core storage model of a word processor, and Swing makes that easy. The text storage just has to implement a simple interface, plug in your own storage object and everything works. If QT4 has something similar, I might be writing native code after all.

  4. Trolltechs license is great by grahamsz · · Score: 5, Informative

    You can buy a commercial license and make closed-source linux applications, while supporting the community financially.

    Or you can stick with the open one...

    I can't see why it would bother microsoft either way.

  5. foreach, like this? by catf00d · · Score: 2, Informative

    I wonder if it's anything like the foreach macro I wrote and proposed for inclusion in the Boost library. Slides and source code available from here.

  6. Re:Does it include something like, well "QDBC"? by Anonymous Coward · · Score: 2, Informative

    Yes, already in version 3, see the SQL module:

    http://doc.trolltech.com/3.3/sql.html

  7. OT: Re:New and Elegant "foreach" ? by Haeleth · · Score: 2, Informative
    I'm still looking for one with static types.

    How about this one? (For the "programmable" bit, see here.)

    Here's Qt's new 'foreach' construct:
    foreach (element, list)
    process (element);
    Here's the equivalent code in Lisp:
    (foreach element list
    (process element))
    And here it is in OCaml:
    List.iter process list
  8. Re:Qt vs Java/Swing by StormReaver · · Score: 3, Informative

    "Java is not perfect, but it's - yes we can say that in public - definitely more productive than c++"

    I've been programming in Java and C++ for years, and in Java for years before learning C++. My productivity with Qt/C++ equals (and in most cases, exceeds) my productivity with Java.

    While Swing on the Mac may have dramatically improved its performance (I'll have to take your word for it), Swing on Linux and Windows are still (as of JDK 1.4x) horrendously slow to start and horrendously slow to run.

    Qt outperforms Java/Swing by a huge margin on those platforms.

  9. Re:Directly against Java? by MS_is_the_best · · Score: 1, Informative

    # So I can write large scale enterpise software in QT?
    Of course, C++ is enterprise ready. No problem.
    # So I can write applets in QT(?)?
    Compile to ActiveX or something. Anyway java-applets suck anyway and are used less and less (fortunately).
    # So QT'll run in smartcards?
    Yes, no problem. Only a C++ compiler is needed and exists in most cases.

    I really don't understand the parent post. Is it flamebait or something?? I bite then, even as someone who prefers GTK... The poster really has no clue or do I not understand the post?

  10. Re:Mono-Culture? by Hard_Code · · Score: 3, Informative

    "Is there even one single non-trivial software project made with/on Mono?"

    Given that Mono runs C#... just survey the landscape of .NET/CLR/C# apps and find out yourself.

    Eclipse (one of the most popular [Java] developement environments) for one has been compiled to CLR bytecode and run on Mono. There is also an ASP engine written on Mono. Go check out the Mono site to see who use it. There are several companies that use it as a production environment.

    --

    It's 10 PM. Do you know if you're un-American?