Page 1 of 10 123 ... LastLast
Results 1 to 10 of 91

Thread: Why is Qt better than GTK?

  1. #1
    Join Date
    Jul 2013
    Posts
    341

    Question 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. #2
    Join Date
    Jul 2008
    Location
    Greece
    Posts
    3,801

    Default

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

  3. #3
    Join Date
    Jul 2013
    Posts
    341

    Default

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

  4. #4
    Join Date
    Feb 2008
    Location
    Linuxland
    Posts
    5,283

    Default

    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.

  5. #5
    Join Date
    Jul 2008
    Location
    Greece
    Posts
    3,801

    Default

    Quote 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; 08-15-2013 at 08:24 PM.

  6. #6
    Join Date
    Jul 2013
    Posts
    341

    Default

    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?

  7. #7
    Join Date
    May 2013
    Location
    Northumberland, UK
    Posts
    99

    Default

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

  8. #8
    Join Date
    Mar 2014
    Location
    US, Lexinton
    Posts
    5

    Default

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

  9. #9
    Join Date
    Sep 2012
    Posts
    780

    Default

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

  10. #10
    Join Date
    Jul 2013
    Location
    Bordeaux, France
    Posts
    320

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •