Slashdot Mirror


GTK-- vs. QT

spirality asks: "The company I work for is getting ready to decide on a GUI Toolkit for our Computational Modeling Toolkit (CoMeT, www.cometsolutions.com). We would like C++ compatibility and ports to various Unices and Win32 platforms. Not supprisingly we've come up with two choices, GTK-- and QT. I've attempted to compare the two by doing alot of web surfing and searching, but I've come up with things that are consistently one or more years old. So, the question I pose is what are the (dis)advatages of GTK-- and QT, and why would I choose one of these toolkits over the other? Overall functionality, momentum for future growth, ease of use, licensing, and pretty much anything else is relevant to our decision." With QT now at version 3.0 and GTK now in the 1.2.x revisions, maybe it's time to give the two libraries some fair comparison and discuss the new features, advantages, and disadvantages of each?

19 of 325 comments (clear)

  1. Licencing by CH-BuG · · Score: 3, Insightful

    If you intend to develop a closed-source product, the licence of both library will probably need to be evaluated too. If you go for
    an open licence, then it's of minor importance.
    (Qt requires licencing fees if you want to keep
    your sources closed).

  2. Before the flame wars start... by CaptainAlbert · · Score: 5, Insightful

    My suggestion - try them out.

    Come up with a few small use cases and let your developers loose on everything you can get your hands on. Both Qt and GTK+ are freely available enough for that to be a useful exercise.

    You might find that, while Qt has nicer abstractions, and provides a familiar set of classes which are (IMO) far superior to MFC... perhaps GTK has a slight edge for lower level work (which it sounds like you might get involved in). Also, see which interface builder tools your team feels most comfortable with.

    The problem with this question is that the replies are likely to degenerate quickly into a C vs. C++ rant-a-thon. Yes, GTK is entirely written in C. But it *is* object oriented. It seems strange to everyone at first, but just because a language doesn't support particular features, doesn't mean that you can't use a particular programming style. OO methodology is just as relevant to C programmers as to C++ or Java programmers.

    If your programmers are good, they'll write good code whatever the toolkit. Just make sure everyone thinks that they got a say in the decision. ;-)

    --
    These sigs are more interesting tha
  3. Some REAL points by faber · · Score: 5, Insightful

    Developing for a professional product I would always go with as many professional tools as possible.

    To me QT seems to be the FAR better decision. It has true interoperablity between Win32, MacOS X and X11.

    QT is C++ from the ground up, GTK-- is wrapping GTK++.

    Furthermore with GTK you definitely write more code to accomplish the same.

    QT 3 gives you access to SQL-databases from its widgets.

    QT comes with a very good interface builder.

    QT based programes feel snappier than GTK based ones.

    One drawback might be that you have to preprocess (actually your Makefile has to) your code before its ready for the compiler, but that's not a big deal.

    With Kdevelop you have access to a very good IDE.

    One thing I don't know is how QT works in terms of different GUI threads, but I neither know for GTK.

    So please, go with QT and be happy

    A much harder decision would be: What should I use for my Web-Frontend, mod_perl or PHP... but that's a different story!

    1. Re:Some REAL points by GiMP · · Score: 1, Insightful

      > QT is C++ from the ground up, GTK-- is wrapping GTK++.

      So?

      > QT 3 gives you access to SQL-databases from its widgets.

      Why?
      > QT comes with a very good interface builder.
      Use vim.

      > QT based programes feel snappier than GTK based ones.
      Opinionated

      > With Kdevelop you have access to a very good IDE.
      Use Vim.

      > Furthermore with GTK you definitely write more code to accomplish the same.

      Maybe, maybe not.. and if so, who cares? Maybe some people like to have a lot of options/power at their disposal.

      Gtk is more commonly used then any other brand. Sure it sucks, but it sucks less.

    2. Re:Some REAL points by Sentry21 · · Score: 4, Insightful

      > QT is C++ from the ground up, GTK-- is wrapping GTK++.

      So?


      QT is OO by design. GTK-- is OO by kludge.

      > QT 3 gives you access to SQL-databases from its widgets.

      Why?


      To make it easier to build database-driven applications without having to twiddle between two libraries.

      > QT comes with a very good interface builder.
      Use vim.
      > With Kdevelop you have access to a very good IDE.
      Use Vim.


      Look, I love g/vim as much as (or more than) the next guy, but it is not an IDE designed for QT, and it is NOT an interface builder at all.

      > QT based programes feel snappier than GTK based ones.
      Opinionated


      An opinion many people, myself included, share. GTK feels sluggish, slow, laggy. QT actually feels like you're interacting with the program.

      > Furthermore with GTK you definitely write more code to accomplish the same.

      Maybe, maybe not.. and if so, who cares? Maybe some people like to have a lot of options/power at their disposal.


      It's not a matter of options/power, it's a matter of more code to do the exact same thing for no reason. GTK is godawful ugly. I can't speak for QT, but everyone I talk to who's used it agrees. You can do more with less and better.

      Gtk is more commonly used then any other brand.

      That's because when QT started out, it wasn't Free as in Speech, so GTK was used instead. Now, GTK is ugly, bloated, and slow, and QT is fast. KDE still sucks, but QT works, and well.

      Sure it sucks, but it sucks less.

      No, it just sucks in more places at once. MS is more commonly used than GTK, doesn't mean it's better, just that it's more common. Same with GTK. It's better than a lot of options, but it's still #2 in my book.

      Don't get me wrong, I love GTK and I hate KDE, but QT just feels nicer and works nicer, and as much as I'm loathe to, I have to admit that.

      --Dan

    3. Re:Some REAL points by bigtoy · · Score: 2, Insightful

      What does having Kdevelope have anything to do with Qt? Regardless of whether you use Qt or gtk based systems you can use Kdevelope. Looks like you are grasping a bit here.

      Why do I care that the widgets provide SQL? I may consider that bloatware and more that I want for my development needs.

      I know lots of professionals that go with products that are open source and not termed "professional" because they are not backed by a company. A good number of professionals use tools that they can modify and see the internals. (Both available for Qt and gtk, so no harm no foul.)

      Qt feels "snappier"? Puh-lease. Lets live in the land of the subjective here. You are obviously lost. Look into the role of the WM.

      BTW, I am not endorsing either product. Just playing the "Devil's Advocate". I hate to see biased, pointless, not clearly thought through arguments used to push someones view.

      --
      "A sample size of one is really just statistical masturbation."
    4. Re:Some REAL points by JimMcCusker · · Score: 3, Insightful

      >> QT is C++ from the ground up, GTK-- is wrapping GTK++.

      >So?

      So QT is also well-written C++, which means it's much easier to write for. C++ wrappers over C libs almost always end up having to deal with Cisms that aren't an issue when using C++.

      >> QT 3 gives you access to SQL-databases from its widgets.

      >Why?

      Because if you want any company that is developing internal applications to use QT instead of VB, it had better have direct access to SQL databases, because about 90% of "enterprise" apps are souped-up database forms strung together in a meaningful manner.

      >> QT comes with a very good interface builder.

      >Use vim.

      And painters should write down specific instructions for a machine to render their paintings. I'm sorry, but being a UI designer, I'd say that most of us, when designing UIs, think visually, not textually. This isn't better or worse, just different. I use emacs and the command line whenever I'm developing backend code, but any time I need to develop a UI, I need to see it, and I'll be damned if I'm going to wait even 3 seconds for a program to compile and run if all I'm doing is checking if I got the constraints on some widget set right. It just interrupts the flow of work.

      >> QT based programes feel snappier than GTK based ones.

      > Opinionated

      Yes, but valid. The response time of a UI is crucial to user acceptance. Anything that takes longer than 1/10th of a second is not instant.

      >> With Kdevelop you have access to a very good IDE.

      > Use Vim.

      See above. Kdevelop also makes it easy to set up automake/autoconf build methods, even for people who aren't familiar with them.

      >> Furthermore with GTK you definitely write more code to accomplish the same.

      >Maybe, maybe not.. and if so, who cares? Maybe some people like to have a lot of options/power at their disposal.

      I care. My time is valuable, and it takes me the same amount of time to write 100 lines of QT code as it does 100 lines of GTK code. If I can get more done with 100 lines of QT code, guess which I'm going to use? The best situation is where the library gives you access to powerful abstractions (like QT does), but then also gives you access to lower level details if you need it. There's nothing to slow you down like dealing with details that don't even matter.

  4. Mozilla? by dannyspanner · · Score: 3, Insightful

    I'm not trying to sound stupid or off-topic here, but have you considered Mozilla? Beyond ther browser, they've developed a really interesting cross-platform C++ (and JavaScript) development platform. For a start there's a cross platform implementation of COM and you can develop your UI's in an XML dialect called XUL.

  5. Re:QT seems to rule by Capt.+Beyond · · Score: 2, Insightful

    You are correct. I have developed with QT for around 3 years now, and back then, I did check out GTK--, and it seemed very much a hodge-podge. I can't imagine it being any better now. I use QT on linux and windows and am going to be porting my program to the SL-5000D. (with the good graces of Sharp) How cool is that?
    If I had a Mac, I'd port it to that.

    --
    -- "Perceptions create reality. By changing your perceptions you change your reality."
  6. Re:Qt if you need Win32 by Orycterope · · Score: 4, Insightful

    Being cross-platform is a major selling point for commerical Qt users, however, so if you need your apps to work on Windows then it's clearly the way to go.

    Absolutely.

    One important thing to note about Qt is the fact that it ain't a wrapper around existing GUI APIs. It emulates the different GUIs out there, so it does the drawing itself, avoiding going through some additional API layers. That translates into a fast and responsive GUI.

    I tried it on both Windows and Linux using the platform's native GUI and GUIs from other platforms, i.e. the Motif or CDE style on Windows, the Windows style on Linux. It is very convincing and very fast.

    When performance matters, I definitely go with Qt.

    Watch out for that "non-commercial" license on Windows though. It might not be appropriate for what you are doing. Your company will probably have to acquire a Qt license for Windows.

    --
    Just because your voice reaches halfway around the world doesn't mean you are wiser than when it reached only to the end
  7. Well.. by DGolden · · Score: 2, Insightful

    Geez. Talk about flamebait topic. Personally (and personal opinion only, here), I'd say, Qt is better designed, clearer, and easier from a programming standpoint - but it's actually not clean C++, what with its dodgy signals/slots stuff, that gtk-- manages to do within the bounds of the language.

    If you're writing commercial, proprietary software, then you have to pay to use Qt - but Trolltech provide a thoroughly professionally supported toolkit to you for your money.

    The Qt class library is actually more akin to the standard set of Java classes than just a widget set - there's decent cross-platform support for sockets, xml, threads, unicode, etc. It really makes C++ programming very easy.

    OF course, there's other cross-platform C++ tollkits like FLTK... The gui toolkit page lists many more.

    --
    Choice of masters is not freedom.
  8. If internationalisation matters... by tempfile · · Score: 3, Insightful

    ...go for Qt. Gtk, IMO, has the huge disadvantage that the current 1.2 revision doesn't support Unicode, whereas Qt fully relies on it and even provides GUI-independent helper classes for all kinds of Unicode conversion that you can use anywhere in the program. This would also help for the mathematical symbols that you probably want to display. It looks like Gtk2 will use Unicode and Pango, thus potentially blowing away the competition, but as long as there's no stable version of Gtk2, I'd go for Qt.

  9. I switched from Gtk-- to Qt by Per+Abrahamsen · · Score: 3, Insightful

    From a conceptual point of view, I like Gtk-- better. It actually uses the modern C++ language, including the C++ type system. This way you avoid the need for a preprocessor, and get static typechecking instead of "dynamic typechecking" (i.e. "the user does the checking"), which is the entire point of using C++ in the first place. It also use the standard C++ library instead of duplicating it poorly, so you don't have to deal with multiple string types and the like. Since the application is a GUI frontend to a library written in standard C++, using the standard C++ library classes, this matter a lot. Qt is written for an ancient subset of C++, something closer to "C with Classes" than the C++ standard.

    However, Qt is simple to use, well documented, and have stable API's. In practice, these make it much easier to use than Gtk--.

    As an extra plus, Qt is GPL and therefore more gnulitically correct than Gtk--, which is only LGPL.

  10. If you want better cross platform support.. by MongooseCN · · Score: 3, Insightful

    ..make your application interface independant. The idea is to make your program a basic application that can run without a gui. The gui is then a plugin or something. That way you can take one application and write a gui using gtk, QT, win32, whatever you want and never have to rewrite the application. This is how licq works. The licq application is stand alone and you can download interface plugins for it, QT plugins, gtk plugins even command line plugins. This is great for me since QT doesn't run on the platform I use, so I have to use the commandline plugin.

    Don't lock yourself into one gui and hope that it will cover all the platforms you need, most of them don't. Allow any kind of gui to work with your program, not only is it more cross platform compatible, but other people can create guis for your application without ever have to touch the applications code.

  11. Re:What about gimp? by FuegoFuerte · · Score: 3, Insightful

    I regularly use the GIMP on Windows, and at least for me, it's at least as stable as any of my other Windows programs. Remember one thing: if it crashes running under *nix, people will get mad. Things aren't supposed to crash under *nix. If it crashes under Windows, people will more than likely say "humbug", restart their computer, and go on with things.

  12. Re:New GTK+ by elflord · · Score: 2, Insightful
    Don't forget that an all-new GTK+ version is just coming out, a cleaner design,

    If they're redesigning the toolkit with every major release, that's a bad sign. Qt has not changed substantially since 1.x, the main difference is that functionality has been added to a rock solid infrastructure.

    BTW, when is the GTK documentation going to be available ? IMO if there isn't any documentation, it doesn't even deserve to be called "1.0".

  13. Qt Locks You In by Anonymous Coward · · Score: 1, Insightful

    If you are developing non-GPL'd, commercial software, then the fact that you have to pay for Qt is not the worst problem.

    The worst problem is that it locks you in to Trolltech as your only vendor for your UI toolkit. No one is is allowed to fork the version of Qt required for commercial apps (at the moment it happens to be the same as the open version of Qt, but there is no guarantee it will continue to be).

    Being locked in like that tends to negate the whole reason for going with Linux in the first place. It not only costs you money, but it limits your freedom, and puts you back on the upgrade treadmill.

    You are better to go with GTK, which is completely open source (LGPL), even if you are building commercial apps.

    Or, if you prefer C++, look at using the Mozilla libraries, which have also been released under the LGPL license (as well as the MPL, and GPL licenses).

  14. Gtk+ on Win32 is NOT a one-man job by Xiphoid+Process · · Score: 2, Insightful

    It is a officially supported first-rate platform being developed in the main Gtk+ CVS tree.

    --
    got drum'n'bass?

    http://mp3.com/vitriolix
  15. Some REAL babble (was Re:Some REAL points) by Pete · · Score: 2, Insightful
    > See above. Kdevelop also makes it easy to set up
    > automake/autoconf build methods, even for people
    > who aren't familiar with them.

    Those people have no business doing software development.
    Um... yeah, riiiiight.

    There are lots of things in the world of software development. Lots of languages, lots of miscellaneous helper tools. Lots of IDEs. I've never used automake/autoconf in my development career, and I've never needed to. Hard as it may be for you to believe, autoconf/automake familiarity is neither necessary nor sufficient to be a good software developer, in C++ or any other language.

    I also reckon that you believe WYSIWYG "html editors" have a place? Maybe for my 10 year old female cousin, but not for anyone else. Yet again, they shouldn't play the game if they are afraid of the ball.
    I get the feeling you'd say that a UNIX sysadmin who wasn't familiar with (and confident enough to modify directly) /etc/sendmail.cf has no business doing UNIX system adminstration either. Even if they were adminning a system without sendmail running? Hmmm.

    Personally, I actually do think that WYSIWYG "HTML editors" have a place. I also think applications like Lyx have a place. It's just a shame that at the moment there aren't any standout contenders in the HTML side that focus on generating standards-compliant HTML (at least as far as I know, I'd be happy to be corrected on this point).

    As an aside, is there any particular reason you say "my 10 year old female cousin," rather than just "my 10 year old cousin" or "a 10 year old child"? Are you trying to imply that she's doubly disadvantaged in being ten years old and female? Or perhaps even more disadvantaged in that she's your cousin?

    SQL is a backend issue, there are no reasons for it to be tied into a toolkit.. if so, it is the worst form of bloat.
    I assume you meant to say "GUI toolkit" there... as a statement like "there's no reason to tie SQL into a database toolkit" would seem more than a little bit senseless.

    Hard as this (again) may be for you to believe, but Qt is not just a GUI toolkit. GUI stuff is a large part of it, but not the only part. I mentioned in another comment that I know of one app, Doxygen, that used Qt without using any of the GUI stuff - simply because the author really like the fact that it abstracted the low-level platform-specific stuff so nicely.

    The other major issue with QT is the terrible licensing. It still sucks, and I doubt it will ever not suck. I would never base my software on something that will make it as valuable as a pile of rubbish one day.
    I love it when people say something "sucks" and offer absolutely no explanation as to why they think it sucks. Try. Come on, have a go. Tell us why the terrible Qt licensing system sucks. Lots of other people in this topic have at least made an effort (and in the process demonstrated that they don't know what they're talking about), but I'm sure you can do better than them.

    IDE.. hah, I'd like to see you use Kdevelop on a text terminal.
    Um... yeah... I'd like to see you use Quake on a piece of paper.

    WTF are you babbling about? If you want to restrict yourself to using a text environment, do so. Nothing stopping you. Of course, if you're supposed to be developing a GUI application, you might not be able to test it at all, but I'm sure that doesn't matter for someone like you.

    Have a nickle, get yourself a real computer.
    Gee. A whole "nickle". Thanks.

    Pete.