tags:

views:

1874

answers:

7

I've been looking at making a cross-platform GUI application, and I'm wondering whether I should use wxWindow or GTk? I'll be coding in C++, so the quality of the documentation surrounding its C++ bindings is key.

I've heard that GTk works better with plain C than with C++. Is this true?

+5  A: 

I think the competition today is probably wxWidgets vs Qt.
Unless you need to use C I don't think gtk makes things particularly easy - especially on windows.

Which is best is a bit "subjective and argumentative", I've used both commercially.

Qt has a large company behind it, you can buy commercial support, good documentation and is available on a lot of platforms (especialy mobiles).
It includes a lot of libraries to abstract OS functions and make cross platform easier (you can use the boost equivalents if you like). It now has it's own IDE and design tools although you can also use Visual studio with a free plugin.
It uses a slot/signal mechanism to handle gui events which is clever but takes a bit of 'getting' initially. It also involves an extra build step where the c++ is run through a special precompiler to add these features that are not part of c++ - once you have it setup it's not a big problem.

wxWidgets is simpler, it is community developed, the original authors are approachable on mailing lists and for contract support. There a re good gui design tools and it's easy to use with Visual studio.
It uses a very MFC-like set of C++ macros to handle the events. If you know MFC using wxWidgets is very simple. The quality of some of the libs lags behind Qt but you can always improve them!

The licenses are similar. Qt is LGPL, you can use it for commercial software but must include qt as a shared library/dll. wxWidgets is modified LGPL - it includes permission for you to statically link wx with your commercial app.

Martin Beckett
+10  A: 

If I were you'd I'd use QT. The GUI builder is fantastic.

Just to add to that, yes GTK is C based but does have a C++ wrapper called gtkmm.

BTW, wxWindows is called wxWidgets these days. is probably a better choice over GTK.

Here is a website that compares WxWidgets with other toolkits. It's a reasonably fair comparison.

http://wiki.wxwidgets.org/WxWidgets_Compared_To_Other_Toolkits

some rants about QT. http://www.crazyontap.com/topic.php?TopicId=46872&Posts=17

Matt H
A: 

QT by all means. It's LGPL now, so you can use it in commercial project. If you came from MFC then wxWidgets will be more easy to learn. QT has different concept, but once you get a hang of it, you won't ever switch to another framework. IMHO QT becomes (became) default GUI framework for building C++ applications.

Sorantis
A: 

I'm with Sorantis, Qt. If you really want either Gtk or Wx, then I'd say Wx. But if you are open to suggestions, I personally think Qt is the highest quality framework around. Its gets a bonus from me for QtCreator, Designer and its top-notch docs.

Shaun
+6  A: 

wxWidgets has some beautiful elegance under the hood... like the ability to show HTML content from inside zip files. The virtual list widget lets you show huge lists of things, and incrementally fetch the things as they come into view. The same list also lets you subclass and provide your own background renderers for each item in the list.

There's a good following of programmers, and widget repositories like http://wxcode.sourceforge.net/index.php I'm currently benefiting greatly from the wxPdfDocument code.

wxWidgets will give you a better result on Mac... and overall I have found that the more I use wxWidgets, the more confidence I have that it will never let me down. wxPython is really a gem of a project too, which lets you do the high level parts of your app in a high level language.

Jim Carroll
+2  A: 

I prefer wxWidgets.
QT is a bit heavy (I mean size of binary libraries) for my projects.

Dmitriy
+1  A: 

I would agree that the competition is between QT and wxWidgets. It would seem to be a waste to learn to use a library that would limit you in terms of target platform. Even if the app you are writing now is only for Linux, the next app you write might be for Windows (or both) .

Personally I find that wxWidgets is programmatically better. It is fast, efficient, easy to use (compared to other similarly powerful GUI toolkits). More importantly it is well structured. wxWidgets was also designed to give applications the native look and feel of whatever platform they are built for. A QT app tends always to look like a QT app (although this in itself is a good thing for some people).

On the other hand, QT has a far better choice in terms of dialog editors/designers. This is not a point to be underestimated particularly if you're designing lots of simple dialogs rather than a few complex ones.

Personally I use wxWidgets, and actually more frequently wxPython (work at the moment requires MFC when using C++, grrrr). Using all the same library knowledge in a completely different language is really useful. Of course there is pyQT etc., but while I have heard negative things said, I don't have any experience with it.

WillW