Announcement

Collapse
No announcement yet.

Why is Qt better than GTK?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why is Qt better than GTK?

    I've heard so many people saying Qt is better than GTK, but I'm yet to see one giving a proper technical explanation of this. I want to know which one is ARCHITECTURALLY better. Qt seem to be more complete and comprehensive, but I hate the following:
    * Qt doesn't use standard C++, instead it uses a layer on top of C++. It just doesn't sound right.
    * Qt reinvents the wheel with QML, compared to GTK which depends on Clutter, JSON, CSS for example.

    So, what am I missing? Why do people seem to favor Qt? Is it only because Qt has some corporate support behind it making it more mature, or there are architectural reasons behind that?

    Please no trolling and flame wars, I want technical answers. And "theme A looks better" doesn't count as technical.

  • #2
    Originally posted by sarmad View Post
    I've heard so many people saying Qt is better than GTK, but I'm yet to see one giving a proper technical explanation of this. I want to know which one is ARCHITECTURALLY better.
    Such questions usually result in biased and subjective answers. One thing to note is that Qt cannot really be compared to Gtk, as it's not only a GUI library. It comes with a platform abstraction layer that has no equivalent in GTK, or even in GLib.

    Qt seem to be more complete and comprehensive, but I hate the following:
    * Qt doesn't use standard C++, instead it uses a layer on top of C++. It just doesn't sound right.
    Not sure what you mean here. Qt does use standard C++ as well as other standards (like POSIX). The layer on top (moc) also relies on standard features and implements reflection support which isn't supported in C++. If you need reflection in C++, you need to implement it yourself, which is exactly what Qt did. Nothing weird here.

    * Qt reinvents the wheel with QML, compared to GTK which depends on Clutter, JSON, CSS for example.
    No idea on that one. I don't use QML (yet) and am not sure how QML differs from Clutter, but I suspect it was needed in order to avoid compromises when it comes to integration with the rest of Qt and its object model.

    So, what am I missing? Why do people seem to favor Qt? Is it only because Qt has some corporate support behind it making it more mature, or there are architectural reasons behind that?
    For me, it was a question of being able to support the three major platforms (Linux, Mac, Windows) from the same codebase. Qt allows me to not only write a portable GUI, but also write portable networking, filesystem and threading code. And other stuff too, like desktop services. Some of those things are also provided by GLib, but with Qt things look more natural and easy to use. For example, the Qt signals and slots mechanism is way more intuitive than GLib's signals or Boost.Signals.

    Comment


    • #3
      @RealNC, thanks for the educated response.

      What I meant by a layer on top of C++ is moc. Although moc relies on standard C++, moc itself is not standard. In reality, moc is merely a syntactic sugar which in my opinion does not justify adding an extra step in the compilation process. I wish if they provide a no-moc option in Qt for those who don't like it.

      In regards to multiplatform development. Can't you have a complete platform abstraction using GTK in combination with other sister projects, or are those still not enough to cover the entire platform? I haven't used GTK myself, nor GLib, I have only used Qt and not for a long time.

      Comment


      • #4
        It should be noted that Qt's wide abstraction is considered bloat and unnecessary duplication by many.

        We have perfectly good standards for things (POSIX, C++ STL, etc etc), yet Qt has reinvented its own wheels, that differ from the standard wheels, for each of these purposes.


        Ie, if you happen to run a system compliant with some standard, Qt's duplication of it is entirely pointless, only wasting space, and fragmenting efforts.

        Comment


        • #5
          Originally posted by sarmad View Post
          What I meant by a layer on top of C++ is moc. Although moc relies on standard C++, moc itself is not standard. In reality, moc is merely a syntactic sugar which in my opinion does not justify adding an extra step in the compilation process. I wish if they provide a no-moc option in Qt for those who don't like it.
          Reflection is a feature offered by Qt, and since C++ doesn't have that feature it needs to provide an implementation. There's no way around it. The argument of whether moc is "elegant" or not is IMO purely an academic one, and is of no particular importance to application developers. I want stuff to work. The less work I have to do to make it happen, the happier I am.

          Note though that much of Qt's features are now implemented using standard C++, since most compilers have caught up with the standard by now, and C++11 now provides ways to get rid of some of that stuff (signals and slots for example can now use pure C++ in Qt 5.)

          In regards to multiplatform development. Can't you have a complete platform abstraction using GTK in combination with other sister projects, or are those still not enough to cover the entire platform? I haven't used GTK myself, nor GLib, I have only used Qt and not for a long time.
          It is possible; there are a lot of portability frameworks out there. But integration suffers, and thus ease of use. You will run into cases where you have to write a lot of glue code. Qt focuses on productivity by having all its parts work together in an intuitive way.
          Last edited by RealNC; 15 August 2013, 07:24 PM.

          Comment


          • #6
            Thanks for the responses. I guess Qt's wide abstraction is what attracts many developers, especially those coming from C# or Java.

            Anyone knows how Qt and GTK compares in terms of performance and memory usage?

            Comment


            • #7
              Originally posted by sarmad View Post
              Anyone knows how Qt and GTK compares in terms of performance and memory usage?
              IMHO those are likely to be subjective but I guess both Qt and GTK+ are roughly the same.

              Comment


              • #8
                Gtk# is a Graphical User Interface Toolkit for mono and .Net. The project binds the ... Want to know how Gtk# is being used in the real world? Check out some ...

                Comment


                • #9
                  Originally posted by sarmad View Post
                  * Qt reinvents the wheel with QML, compared to GTK which depends on Clutter, JSON, CSS for example.
                  I don't have much to add to the detailed answers of RealNC, but as I have used QML a bit, these are its very strong points (in my opinion):
                  - Declarative language: just like systemd's unit files, you do not write the steps to create the UI, you declare what the UI should be.
                  - Object focused, extensible: You can create a MyButton object elsewhere (in some other QML file, or directly in c++) and reuse it easily
                  - Expressive: html is the standard declarative language, but nobody would want to write in html directly, it's too verbose. It's not that different from JSON, but with objects types instead of key strings, and a bit more relaxed syntax.
                  - Bindings: these are automatic signal and slots between QML objects and QML and c++ objects. Very useful for dynamic UI's
                  - The actual dynamic languages are not too bad: glue code is actually mostly standard javascript, and extensibility is done via Qt/C++

                  I haven't used Clutter (or even QWidgets) so I cannot compare, but I like QML very much. I find it better than WPF for example.

                  Comment


                  • #10
                    Originally posted by curaga View Post
                    It should be noted that Qt's wide abstraction is considered bloat and unnecessary duplication by many.

                    We have perfectly good standards for things (POSIX.
                    I stopped reading here. Plese explain how useful are POSIX skills when developing an Android, iOS, or Windows 8 app ?

                    Like it or not, this is where is the cash, and where are the most developers.

                    Comment

                    Working...
                    X