Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

GTK-- vs. QT 325

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?
This discussion has been archived. No new comments can be posted.

GTK-- vs. QT

Comments Filter:
  • Qt if you need Win32 (Score:5, Informative)

    by Ami Ganguli ( 921 ) on Friday November 23, 2001 @08:33AM (#2603401) Homepage

    I actually prefer GTK+ and I think it's a better bet long-term, but I don't think the cross-platform aspect of the library gets much developer attention.

    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.

  • by Balinares ( 316703 ) on Friday November 23, 2001 @08:34AM (#2603403)
    You may also want to take a look at the wxWindows toolkit [wxwindows.org]. It's a wrapper over what's available on a given platform (the native API in Win32, GTK in the Unix world, and there's a Mac port in progress, I believe). Good stuff, definitely, especially if what you want is C++ and portability. Note that your apps will look totally windowsy on win32, so your users will not be confused by their look.
  • by Dooferlad ( 101535 ) on Friday November 23, 2001 @08:41AM (#2603417) Homepage Journal
    ...but a little slow on Solaris 8. Maybe it is just me, but my build of Mozilla really jerkey on a workstation (UltraSPARK III, 2G RAM). On the other hand The Gimp runs like a dream on my Windows box, and Mozilla is zappy on Linux.

    --
    Dooferlad
  • licensing (Score:5, Informative)

    by Cardinal Biggles ( 6685 ) on Friday November 23, 2001 @08:41AM (#2603418)
    Overall functionality, momentum for future growth, ease of use, licensing, and pretty much anything else is relevant to our decision.

    To pick up your point on licensing, Qt is either GPL or pay. So if your application will also be GPL, it's free, if your application will not be GPL you will have to pay up for Qt. GTK is LGPL AFAIK (enough acronyms for you? ;-) so that will not stand in the way of making your app non-free.

    BTW, if you know C++ and want to get to know a bit about Qt, they have a pretty good tutorial online here [trolltech.com]. Just walking through the examples made me realize just how cool it is, and how much you can do in just a few lines of code.

  • GTK+ C++ wrappers (Score:5, Informative)

    by HalfFlat ( 121672 ) on Friday November 23, 2001 @08:44AM (#2603429)

    I worked on a rushed project earlier this year, and used the gtk-- C++ wrapper for GTK, as well as the gnome-- wrapper (then still very much under development) for the Gnome libraries, specifically the canvas.

    Personally, I found it frustrating to use. As these wrappers are still being worked on, the documentation is sketchy. The object-owning semantics are confusing (at least to me) - I was forever leaking memory or prematurely destroying objects. Trying to destroy something from within a menu callback I recall was particularly noisome. The gnome-- canvas wrappers were a moving target, though they may have since stabilised, and didn't fully expose the canvas API. Writing one's own canvas items is done in C, and then wrapped.

    Perhaps with more persistance I might have figured out how to set up keyboard acceleration, but it is at anyrate a real battle to find documentation that explains what is going on with it. AFAIK, there is no straightforward way of making a multiple file selection in GTK+ 1.2. In gnome canvas (not GTK+, but a close cousin) there is promised functionality that is simply not implemented - I'm thinking here of smoothed lines, for which the code reads:

    /* FIXME */

    I haven't used QT yet. It certainly looks pretty, and a quick glance at the example code and docs provided seems to indicate that it's not too complicated, and well documented. I'd certainly shy away from GTK+ if a C++ interface is required.

    The new version of GTK under development should address many of the shortcomings of the current toolkit, and includes goodies such as Pango. It is not yet in a stable state, however, with the API still undergoing final tweaking I believe.

  • by jonathan_ingram ( 30440 ) on Friday November 23, 2001 @08:45AM (#2603431) Homepage
    I'm a great fan of Qt, but I don't believe it's always the best toolkit to use for cross platform compatibility (although it is the best toolkit available for UNIX-based systems), plus there are complications about the licenses differing versions are available under. GTK-- and its competitors (Inti?) only have a very small user and documentation base, so they are probably not a good choice for a large commercial project.

    If you want cross platform compatibilty with C++, then check out wxWindows [wxwindows.org]. It has ports to Windows, MacOS (9 & X), UNIX + Motif, UNIX + GTK. It also has a very well developed Python binding [wxpython.org] -- so well developed that quite a few people want it adopted as the official Python GUI instead of TKinter.

  • by mvw ( 2916 ) on Friday November 23, 2001 @08:52AM (#2603442) Journal
    Another alternative is using Mozilla as IDE. This might sound a bit crazy right now, but I believe this idea will get more followers, if Mozilla gets more and more stable.

    An example is the Komodo IDE [activestate.com] by ActiveState, which uses XUL.

    XUL [xulplanet.com] is the next generation browser application platform. Simply speaking, the Mozilla [mozilla.org] team chose an approach very similiar to JAVA [sun.com] to come closer to a platform independent graphical user interface:

    • implement a set of base compenents on the most popular platforms (Win32, Mac, UNIX, ..), that render your JAVA specific widgets in terms of the native GUI.
    • implement your applications in your JAVA language
    • compile application
    • distribute JAVA binaries

    XUL goes one step farther, as there is no compilation step.

    The XUL application implementation language is a XML language that together with cascading style sheets and JavaScript glue will yield an application one starts in the browser by opening the .xul document.

    A possible advantage of XUL might become the relative ease of application development, change and distribution.

    Possible problems will be similiar to the ones known from JAVA. The qualitiy of XUL applications will stand and fall with the quality of the XUL implementation for a specific platform, which right now means the quality of its Mozilla or Netscape implementation.

    Of course, compared to JAVA, which has underwent several larger development cycles and now features mighty libraries, XUL is a bleeding edge technology at its beginnings.

    However it is still possible to make direct use of the various Mozilla widgets as well from C++.

  • Re:What about gimp? (Score:5, Informative)

    by Ami Ganguli ( 921 ) on Friday November 23, 2001 @08:58AM (#2603454) Homepage

    It exists, but I don't think it's maintained as well. The primary developers don't really care about Win32, so maintaining it is left to a few masochists :-).

  • Re:Licencing (Score:2, Informative)

    by zmooc ( 33175 ) <zmooc@[ ]oc.net ['zmo' in gap]> on Friday November 23, 2001 @09:04AM (#2603470) Homepage
    As far as I know/understand, QT is GPL and GTK is LGPL so you can't make a closed-source application based on QT unless you buy a license from Trolltech.
  • New GTK+ (Score:4, Informative)

    by JanneM ( 7445 ) on Friday November 23, 2001 @09:12AM (#2603484) Homepage
    Don't forget that an all-new GTK+ version is just coming out, a cleaner design, vastly improved i18n support, and all. I suggest you look at GTK2 (and it's C++ wrappers) as well, as this is what's going to be used, rather than the current version.

    /Janne
  • by hattig ( 47930 ) on Friday November 23, 2001 @09:26AM (#2603518) Journal
    Knowing companies like I do, they will go with the most expensive solution - because expense usually means support. In this case QT is clearly the way to go, as everyone is pointing out (okay, wxWindows is another good choice, but I have no experience with this system).

    QT has an easier to program API, is quick to program in, has great documentation, has support, has a huge wealth of existing code examples, and is supported on Windows. GTK is not supported on Windows, and is a one-man port job. Fine for free software like the gimp, but not for a commercial application. Don't save a couple of grand on the GUI toolkit and get yourself a lot more costs in support that you have to provide because of problems.

    GTK2 might solve a lot of the problems in the current GTK of course, but I am not qualified to comment about that. And do you really want to program using a just finalised API?

    QT just does things right. 'nuff said.

  • Re:licensing (Score:3, Informative)

    by Snowfox ( 34467 ) <snowfox@NOsPaM.snowfox.net> on Friday November 23, 2001 @09:29AM (#2603533) Homepage
    Overall functionality, momentum for future growth, ease of use, licensing, and pretty much anything else is relevant to our decision.
    To pick up your point on licensing, Qt is either GPL or pay. So if your application will also be GPL, it's free, if your application will not be GPL you will have to pay up for Qt. GTK is LGPL AFAIK (enough acronyms for you? ;-) so that will not stand in the way of making your app non-free.

    Just remember that you only need to give your source to any entity you give the binary to. Being GPL/LGPL doesn't mean you can't use it for business use; the license is entirely transparent for apps which will only be used internally.

  • by Dr. Evil ( 3501 ) on Friday November 23, 2001 @09:38AM (#2603556)

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

    The LGPL was written specifically to get around the 'viral' aspects of the GPL. Meaning that while Gtk-- gives you the option to GPL your product, QT does not. With QT you MUST use the GPL... unless you pay Troll Tech an arbitrary, although currently quite reasonable sum.

  • Re:What about gimp? (Score:2, Informative)

    by egghat ( 73643 ) on Friday November 23, 2001 @09:40AM (#2603563) Homepage
    yeah and that's a big shame.

    GTK porting was mainly done by one single person.

    I think, there are a few other GTK based apps, which Windows Users would like. But without a stable GTK on Windows?

    Bye egghat.
  • by hpj ( 26910 ) on Friday November 23, 2001 @10:19AM (#2603660) Homepage
    I have been using Qt for some years now starting with Qt 1.0 some years ago. I have also tried to both patch GTK+ programs and in one instance port one of my Qt applications to GTK+ (I was preferring gnome at the time).

    The advantages I can see from using Qt is:

    * Superb design. The OO design of Qt is really thought out. There are virtual function to do all the basic things you can think of and if you think of something really clever there are lowlevel routines to do that too.

    * Superb documentation. A comprehensive, hypertext help and in Qt3 an included help browser. This is really an advantage since GTK+ not really being supported by a commercial entity suffer from lots of "I'll rather code than document" in the libraries.

    * Good migration path to new versions. I have a program consisting of ~100000 lines of code (An Oracle client http://www.globecom.net/tora) which I migrated to Qt3.0 in about 2 hours, some of that time was spent using Qt3 specific features also like docked windows where appropriate.

    * Not only a GUI toolkit. It also includes primitives for handling threading, I/O (files and sockets), UNICODE conversions and also some basic template classes made mostly obsolete now that STL is starting to actually work in GCC.

    * Truly multiple platform. The application above was ported to Windows in about a day, all of the problems related to the fact that Visual C++ understands a different dialect of C++ than most of us are used to and that took some time write around, none of it was Qt specific. The extra thread and I/O classes really helps here as well.

    /Mauritz
    GlobeCom AB
  • by cjhuitt ( 466651 ) on Friday November 23, 2001 @01:42PM (#2603772)
    About a year ago, the company I work for went through this. (This was before I worked for them.) The company debated the merits of Gtk-- and Qt. The basic conclusions were that Qt would (or at least, should) have the better support and documentation, and lack minor irregularities. However, when it was all computed, the deciding factor was the licensing fees. Since our software would be quasi-commercial (we are a consulting company, but for a fee, we provide companies with portions of our software as well) we would have to pay the licensing fee for Qt. This was a lot more than was thought our ~6 person (at the time) company could afford, so we went with Gtk-- pretty much only for that reason.

    Now that we have been using Gtk--, we have relatively few regrets. The documentation was poor, for a time, but they have semi-recently improved the documentation, and it is quite workable. There are some small things that you would think would be done differently, but overall they are very minor and easy to live with.

    Since we aren't concerned (yet) with porting our software, that wasn't much of an issue. Of course, your situation may be different there.

    Finally, echoing what other people have said here, Gtk-- can be quite low level at times. I would recommend that if you decide upon Gtk--, you do what our company has done. We created our own set of libraries that provide standard looks to things with minimal hassle, derived from the Gtk-- classes. An example of this would be windows. We have our own window class that sets up standard options that Gtk-- allows to vary considerably. (Additionally, it automatically checks for certain keystrokes, like the F1 key, and signals that fact.) Making a button class would be similar, so all of your buttons are approximately the same size, have the same shading, etc. We were late in figuring this out, but it has greatly simplified our code and made our program look much more consistent.

  • by Szplug ( 8771 ) on Friday November 23, 2001 @03:06PM (#2604208)
    I was examining cross platform GUIs a couple years ago, and gave wxWindows a try; it's ugly (full of arbitrary little macros) and, as the subject says, when I installed it and tried their example programs, some either failed to compile (or more likely) failed to work (my memory is unclear). Overall my impression was that it was a mess. Now, that was 2 or more years ago, but I haven't heard much about wxWindows since. We went with Qt, and it's clean & fast; I prefer it even to MFC (which admittedly may not be saying much).
  • by VZ ( 143926 ) on Friday November 23, 2001 @03:39PM (#2604252)
    [disclaimer: my real email address is @wxwindows.org]

    > Not supprisingly we've come up with two choices,
    > GTK-- and QT.

    This surely is surprizing to me. I wouldn't consider GTK-- a serious choice for writing Win32 programs - sure, it "works", but have you seen it and/or used any GTK+ programs under Windows? But I would consider FOX, FLTK and wxWindows as serious contenders to Qt.

    I can't speak of the others but let's compare wxWindows and Qt:

    1. wxWin has almost all of the features Qt has
    (it doesn't have some, but then it has some extras)
    2. wxWin is free (as in beer too) for all uses
    3. wxWin has native LNF, even under Windows XP
    (which can be a serious advantage if you
    target this platform).

    But try it for yourself - wxWindows 2.3.2 is scheduled for Dec, 2 and has quite a few interesting new features. And see www.wxwindows.org for more info.
  • by Futurepower(tm) ( 228467 ) <M_Jennings @ not ... futurepower.org> on Friday November 23, 2001 @03:58PM (#2604309) Homepage

    GTK:
    GTK [gtk.org]

    QT:
    QT [trolltech.com]
    Excellent QT Tutorial [trolltech.com]

    wxWindows:
    wxWindows [wxwindows.org]
    wxPython [wxpython.org]

    Mozilla:
    Mozilla [mozilla.org]
    Cross-platform implementation of COM [mozilla.org]
    develop your UI's in an XML dialect called XUL [mozilla.org]

    Others:
    FLTK [fltk.org]
    Fox Toolkit [fox-toolkit.org]

    Side-by-side comparison of GUI Toolkits:
    The GUI Toolkit and Framework Page [geocities.com]

    I needed this list for my own use. Maybe it will be of interest to you.
  • by Sludge ( 1234 ) <[gro.dessot] [ta] [todhsals]> on Friday November 23, 2001 @03:58PM (#2604310) Homepage
    I second this, and find it not offtopic at all. wxWindows doesn't get anywhere near as much press as the other toolkits, but it's got fully fleshed out documentation available in a number of formats, active developers, four mailing lists of which I can attest the developer one getting 15-20 messages a day and ships with tons of code samples.

    The license it's under is acceptable (to me), and there are working large apps such as Audacity [sourceforge.net] out there.

    When I discovered all of this, I decided to look into the technology side of things. To throw more goodness at you, let me say reiterate that the toolkit looks native to your environment which is a big win. On top of that, it lets you do things which aren't lowest common denominator and exist in only one or more environments, such as toolbar icons in Windows.

    I also like the class hierarchy. I had never done GUI programming before but everything came across rather clearly when I started reading the documentation.

    Additional to all the "low level" GUI junk, it also contains some routines for networks and a portable wxString class which is a lot like stl::string with more methods added. I found myself using this almost immediately and I haven't looked back.

    It's worth learning this stuff just to get away from MFC without taking the speed hit of learning Java/Swing and having to learn a whole new language and culture. There is even some boasting about how 'the Java honeymoon is over' on the page, stating that wxWindows is actually a more portable toolkit. :) ymmv.

    There are both Python and Perl bindings for it. I haven't looked into either really, but at least the Python ones seem to be of high quality as a number of people on the mailing list are Python programmers.

    Check it out [wxwindows.org] before coming to a conclusion of what toolkit to use. It's worked for me.

  • by mill ( 1634 ) on Friday November 23, 2001 @07:01PM (#2604989)
    If it hasn't been mentioned yet

    Al Stevens took a look at both Qt and Gtk-- in the September and October issues of Dr Dobbs Journal.

    What he didn't like with Qt:

    • No namespaces
    • Language extensions to implement slots
    • An ill-organized and unnecessary RTTI mechanism
    • Custom rather than standard containers
    • Questionable C++ coding conventions

    The last (I think. I only have October) refers to that Qt takes ownership of objects instantiated on the heap i.e. new without a corresponding delete. Which means you have to do all instantiating on the heap because there is no portable way for Qt to know if it is on the stack, external, or static memory.

    He thinks Gtk-- remedy all these problems and he actually found the tutorial funny albeit a work in progress.

    /mill

  • Re:GTK-- is not GTK+ (Score:2, Informative)

    by ShallowBlue ( 117910 ) on Friday November 23, 2001 @07:42PM (#2605090)
    "[...] Qt is in a C++ like language that must be first preprocessed to produce C++."

    First of all that is a serious exageration! Second it does not matter even if from a esthetical point if view the preprocessing of the headers is not nice. Why? Because the decision for a specific product/venor leads to vendor lock (see Anti Patterns) in any case.

    You rely on a library. Your code will not compile if that library is not there! In the case of Qt you also rely on a little preprocessor program --- so what? If you use GTK or Win32 or MFC that don't need the preprocessor what is the difference? You cannot take your MFC program and compile it using say GTK.

    The only thing you can do is to try to introduce clear layers that separate you program logic from the GUI to contain and localize the damage in case you have to go from one GUI library to another.

    This is also my answer to the criticism that Qt (which was started in pre STL times if I am not completely wrong) uses non-STL containers. Separation of GUI and core program allow you to use more approprate/modern/protable technologies in the core. It is the architect's/designer's/programmer's choice where to use these non-standard constructs and how deep you will move into vendor lock.

    Especially tricky in the case of Qt is that Troll Tech also offers a Qt specific abstraction layer for low-level constructs like threads/locks/sockets, etc. This means that if you are not carefull your software is locked at the top and at the bottom. If these low level services are used I would recommend to wrap them into a platform isolation layer. In the case you want to change you can replace these services using the native OS constructs or libraries like ACE, etc.

  • by mughi ( 32874 ) on Friday November 23, 2001 @11:59PM (#2605756)
    That's complete bullshit. Qt's commercial license has no clause like that

    No, it's not. All the free licenses have that. non-commercial, free, educational, etc. Check the TrollTech General FAQ [trolltech.com]

    Q:Can we use the Free Edition while developing our non-free application and then purchase commercial licenses when we start to sell it?

    A: No. The Free Edition license applies to the development phase - anything developed without Professional or Enterprise Edition licenses must be released as free/open source software. [emphasis added]

    That, along with the FAQs, statements, etc. from Trolltech's past seem to make it clear. Go check their site yourself. Perhaps have a lawyer check the mentioned Professional and Enterprise Edition licenses and let us know if you're right and Trolltech is wrong.

    Go away, troll.

    I'm not trolling, just trying to point out issues with the Qt licenses. If you start with a commercial license and never want to ship shareware with it, or if you start with the proper free license of your project and keep it open-source forever, then it's not bad.

  • by Pete ( 2228 ) on Saturday November 24, 2001 @12:48AM (#2605861)
    Hi Szplug (hmm, Tintin fan?)
    I was examining cross platform GUIs a couple years ago, and gave wxWindows a try; it's ugly (full of arbitrary little macros)
    The macros aren't arbitrary, but there are a fair few of them though. I guess there are a few techniques you can use to help manage event handling - Trolltech uses C++ extensions, wx uses macros. Once you get used to them, it's not really an issue.

    and, as the subject says, when I installed it and tried their example programs, some either failed to compile (or more likely) failed to work (my memory is unclear).
    I've only been using wxWindows for about a year, so I can't really comment on how easy older releases were to get working. But I can say that the current ones work fine - if you're willing to give it another go sometime, you may find life a lot easier.

    Overall my impression was that it was a mess. Now, that was 2 or more years ago, but I haven't heard much about wxWindows since.
    It's not a mess. It's not as slick and nice as Qt, but it's very stable and reliable and certainly not a mess. And while the wx documentation is solid and perfectly usable for a capable C++ programmer, it's not as complete or as well-written as Trolltech's Qt documentation. I still mention the Qt documentation to co-workers as an example of what tech documentation should be - I've never seen anything to match it.

    We went with Qt, and it's clean and fast; I prefer it even to MFC (which admittedly may not be saying much).
    *grin* Indeed it is not. But yes, Qt is a very very nice GUI library ... and not just GUI either. Doxygen [doxygen.org] is a good example of an application that for a long time used Qt even though it (Doxygen) didn't have a GUI - just because the cross-platform abstractions were so useful.

    I certainly wouldn't recommend you change from Qt to wxWindows... I do think Qt is technically superior to wx, but there are reasons why you might find wx more appropriate for future projects with different needs. Try installing wxPython [sourceforge.net] and have a look through the demo app - I find this a great way of showing off the features/functionality/look/feel of wxWindows to people, even if all the demo apps are written in Python. You can get a good feel for the way the same apps would look in C++ even if you don't know much about Python.

    Pete.

Saliva causes cancer, but only if swallowed in small amounts over a long period of time. -- George Carlin

Working...