GTK+ or Qt under Windows [closed] - qt

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I was wondering which one should I consider if I need the software to be used on both platforms, WIN and Linux and why?

Packaging GTK and its dependencies on Windows is a full-time project in itself. Qt is much more easily distributed since it has no dependencies that do not come with Windows.
Qt has been cross platform from the start. GTK has not always been cross platform. Such fundamental decisions shape the overall design, and should be made before any code is written in my opinion.
I would comment more, but I'd be drifting into speculation, the above two things I know for certain.

Both are good toolkits that have their advantages and disadvantages.
One difference is the implementation language. Qt is in C++, and GTK+ is in C. However GTK+ has bindings for many, many other languages (perl, python, C++, .NET, etc) so it's not a huge issue.
An Advantage of Qt is that it offers a bit broader range of functionality built in (xml, database access, network programming, openGL, etc). GTK+ has basically all of these things within its orbit (e.g. libxml2, librsvg, libsoup, libgda, etc), but they're not as much of a single coherent package as Qt is.
My personal recommendation is to use gtkmm, the C++ bindings for GTK+. It offers a more comfortable object-oriented language to program in, and it provides nearly the same native performance as using GTK+ from C. (Disclaimer: I contribute to gtkmm).

GTK+ you can use almost in all programming languages, in C++ (using gtkmm) in C (gtk+) in C# (with Gtk#) in Python (PyGtk). Behind GTK you have Mono Framework which is great implementation of .NET Framework for cross platform purposes. If you want to use Gtk# you have great IDE (MonoDevelop) with a very powerful gui designer. You can take a look at www.mono-project.org. But still depends what do you want to build, you are looking just gui toolkit, or the entire framework? And the logic behind signals/slots are the same in Gtk+ and Qt, but if you are using Gtk# they are transformed in the delegates/events paradigm.

my $0.02:
I've used Qt off and on for the last 4 years, and it's hands-down my favorite toolkit of anything I've tried (Win32, MFC, Borland, Java, GTK). I used GTK for a few weeks to try it out, and didn't like it. Mostly that was because I think it's awkward to use C instead of C++ for GUI apps on a PC... I do embedded work too, and I'd never use C++ on an 8051, but for a big GUI app I much prefer it. If you're going to try GTK, I'd suggest looking in to GTKmm, although I've never used it myself.

You might also consider wxWidgets. I have never used any of them but when I was looking over the cross-platform toolkits it was the one I had decided to try.

They are both fine toolkits. I'd base my decision on the licensing. Qt requires that you pay for a license if you are using it in a commercial product wheras GTK does not.

Three additional points in favor of Qt:
Your project does not have to be GPL; there are many other open-source licenses available in the Qt GPL Exception, including BSD and LGPL.
Qt's default theme on Windows does a much better job of blending in than GTK's Wimp theme.
If you want to support Macs later, you'll have a much easier time with Qt.

I would prefer Qt. As today, Qt is Open-source and free under more permissive, LGPL license.
Qt is better ported for Windows and looks more native than GTK. Gimp on windows, for example, looks very strange, because most of its dialogs are not Windows dialogs. Qt can use native Window dialogs like Open/Save which makes it feel better as a framework. And yes, Qt is a framework, not only a GUI Widget. No, I am not advertising Qt here, as Qt have some strangeness for a windows user from development point of view, for example, Qt is Layout based while MFC / .NET are anchor based and Qt's Layout managers are sometimes strange. But if I have to choose between both GTK and Qt, I will select Qt. Also, now, Qt comes with very good IDE, Qt Creator, which is my default C/C++ IDE for all types of projects now (as Qt Creator can be used as such).

Qt 5.0 has won the war.
I'm not a huge fan of C++ (I prefer plain old C), but I must admit that the Qt framework is amazing.
Try to write a GUI program with GTK that runs on OSX, Linux, Windows (and soon iOS and Android) with native look-and-feel... Good luck !

I recommend to use Qt because:
It's cross-platform and and covers wide range of operating systems (including mobile)
It is opensource and has a fast speed in getting better
It has the a nice GUI designer and a very capable IDE (Qt Creator)
The API design is excellent and easy to use
It has a great documentation which is easy to read
It has the Qt translation system which enables you to have a multilingual app
The GUI layout system where the widgets resize themselves according to a layout makes everything much easier
The QML gives you the power to create fantastic GUI with great graphics and animations
It has great support for networking and connectivity(socket, SSL, www, IPC, ...)
It has QTestLib for testing the code
It has many language binding if you don't want to use C++

Related

Best widget toolkit for developing desktop environment for xserver?

Suggest a good widget toolkit to devlop GUI. I've worked with QT, GTK+ and X11, wikipedia shows a lot, is there anything better than than qt? To work with multi touch computing. I cannot start from the scratch with X11, and gtk is tough, QT is easier, but is there anyother toolkits like gtk or frameworks like qt to server better?
I'd suggest you to use the richest possible GUI framework. This way you will eliminate lots of unnecessary code and reuse existing functionalities.
If you'll take above into consideration, you'll have two options (dropping GTK because of complexity as you say, and bunch of other less maintained and less popular toolkits):
Qt
WxWidgets
I've worked with both and both share somewhat similar concepts, but IMHO Qt is better documented, better maintained, and is used by far more developers than WxWidgets, plus it have more sophisticated tools like QtCreator, etc.
On the other hand I like that WxWidgets has manual programming approach, where you're practically forced to build the GUI from code.
One very important thing to mention:
Qt has support for embedded
Linux, eliminating the need for
X11.
Some literature:
WxWidgets Compared To Other Toolkits
...and other Google results

What's easier and cleaner? GTK or QT? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Can someone suggest what's the best uses for those libraries today? Is it just GUI, or do they have database, XML, networking, threading, etc support too?
I was reading about them, and considered starting to learning/using one of them.
What is the most common one? What's the difference between them? Why would you choose one over the other?
As you seem to primarily target Linux, then the choice mostly depends on the programming language you want to use.
If you code in C, then obviously go for GTK+
If you code in C++, go for Qt, otherwise you will need Gtkmm (a C++ wrapper over GTK+)
If you code in Python, both GTK+ and Qt have bindings for the language: see PyGtk, PyQt and PySide (the one launched by Nokia themselves).
If you code in Java, Qt is no more a viable option imho as Nokia discontinued Qt Jambi (the Java bindings for Qt).
Also, Qt is more top-notch regarding its scenegraph QGraphicsScene API, its scripting engine built over Javascript Core (the engine powering WebKit), its state machine and animations framework, and the declarative UI.
GTK+ doesn't offer that much although you can use Clutter alongside with it.
If you're specifically looking into DB, XML (GTK+ has a parser for a subset of XML) and threading (GTK+ has GLib) features then Qt will offer all that in QtSql, QtXml and QtConcurrent.
All in all, I would say Qt is a sure choice. But GTK+ is very capable as well.
I'm not sure you will get a crystal clear answer for your question, which explains why some people keep preferring Gnome over KDE or vice-versa. Choose what works best for you.
PS: I you plan to also target Symbian, then go for Qt.
EDIT: Something that is also great with Qt is QtWebView: it brings Chromium into your Qt application to display web content. Others are embedding web content into their application using for instance Awesomium or Berkelium.
I've used GTK+, QT and wxWidgets before. Here's a brief summary:
For my first cross platform UI project I decided to go for wxWidgets mainly because at the time the license wasn't as restrictive as QT's (QT was GPL and only for Linux) and it had platform specific UI (unlike GTK). The project worked out well but there were quite a few glitches getting it to compile and run properly in other platforms - sometimes some events were fired up differently and such. Also GDI in wxWidgets was pretty slow.
Next I used GTK for a different project in python. For this I used the python bindings and everything worked out more or less smoothly. I didn't quite like the fact that the UI didn't look native on Windows and Mac and also when you launch a GTK+ app it always debug outputs loads of CRITICAL warnings which seem fine to ignore. :S
Finally, I did a very simple QT project now that Nokia has acquired it and was brilliant. The best of the three. First off, if you're not an old schooler who prefers VI or Emacs, QtCreator is brilliant. I really love VI and used it for years but I much prefer QtCreator for C++ QT projects. Regarding the library I also liked a lot the documentation and the APIs provided. QT has a concept of slots and signals which introduce new C++ keywords and a preprocessor. Basically, after reading a tutorial you'll get it easily and will start to love it. I'm now doing iPhone dev and it does feel a bit like Cocoa's/Interface Builder's UI paradigm.
Summary: I'd go for QT hands down. The license is pretty good and the SDK and documentation really nice.
I have never used GTK, but from my personal experience using Qt:
It is much more than a simple GUI. It's a whole application framework. I used to think of it as the Java libraries for C++. It provides all you mention -- database, XML, networking and threading, and more. It also provides things such as containers and iterators, and counterparts to a number of boost libraries.
The thing that impressed me most when starting to use Qt was the extremely extensive documentation. You get a program called Qt Assistant, which provides fully indexed and searchable API documentation on your desktop, as well as numerous code examples and tutorials. I found it made a big difference in searching the web each time for API info. Very quick access when you need to remember a method signature.
I am not sure which is most common; that's probably hard to measure accurately. They're certainly both popular. As Gnome is the default desktop of Ubuntu, and Gnome sits on top of GTK, it obviously has widespread usage. Of course, KDE is very popular as well. Nokia is heavily pushing Qt in the mobile space -- their Maemo OS, used on the new N900 for example, is soon to switch to Qt as the default toolkit (currently it is GTK.) I believe Qt will also soon become the default toolkit for Symbian OS.
I have not used Qt Creator, but I have heard many good things about it. It is a C++ IDE with obvious heavy integration with Qt. It also has fake vim emulation which is always nice if you like that kind of thing!
Qt uses qmake for build configuration. I found this much nicer than having to write your own makefiles. I do not know what GTK uses for building.
A couple of things I found a bit offputting with Qt at first was its big uses of preprocessor macros. The signal/slots system provides a nice mechanism for event/message passing in your application, but it does feel a bit like magic that may not be easily portable to another toolkit if you ever want to. Also, the moc (meta-object compiler), while I'm not entirely sure what it does, also feels a bit too much like magic going on behind the scenes.
All in all, though, I would recommend Qt, particularly if you are learning. It has really amazing documentation and a nice IDE, and busy forums. You'll be able to build C++ apps very rapidly with it, particularly with the QML coming in 4.7.
It probably depends on what you want to do. I would recommend Qt, because it's more than GUI, it has nice Python bindings (so does Gtk), and GUI libraries themselves are (subjectively speaking) more pleasant then Gtk.
Gtk is on the other hand more common in linux world, so you can probably get more help on the web. Reason for widespread of Gtk probably has more to do with Gnome and Ubuntu, rather then technical merits, but if you want you software to blend nicely with those two, you'll achieve that more easily with Gtk.
Qt for one sure has solid DB, network, threading support etc... It does a lot more then just cross-platform GUI (and it does most of it quite well).
I'd recommend it over GTK+.
Qt. It's not only object oriented, is "good" object oriented.
It's based on a "subset" of C++ that doesn't rely on the obscurity of C++ (but you are allowed to stick with them, if you fancy masochism ;) ).
It has a strong momentum now that Nokia bought it (actually Nokia did ~2/3 years ago). It's going to be in all Nokia AND Intel mobile devices (smartphones, netbooks, tablets).
It's the backbone of KDE, so it's very mature, but it's designed in a very flexible way, that makes it possible to support TODAY all the latest "cool stuff" that a more-then-just-GUI framework should have.
Go for it.
Just adding QT advantages to other answers.. QT has great documentation, its own IDE & GUI creator and enhances C++ with some new concepts like slots/signals (basically events).
I am not a GTK developer, so I can't compare those to the GTK world :(
It also looks like Nokia is about to use Qt everywhere, like on Maemo
If you want your app to run on iOS, Android, Blackberry, other mobile platforms, Windows, Mac OSX, and Linux, use Qt.
qt-project.org

Gtk+ vs Qt language bindings

Put shortly: For those familiar with language bindings in Qt and Gtk+. E.g. python and ruby. Are there any quality or capability difference?
More background: I know C++ and Qt very well. Minimal experience with Gtk+. I know C++ is not ideal for language bindings due to the lack of a well defined ABI (application binary interface). I also read that Gtk+ was designed to be bound to other languages. So I wonder how this manifets itself in practice. Are the Gtk+ bindings better maintained or work better in some way than their Qt counterparts?
I am presently quite interested in the Go language, and they have started developing Gtk+ bindings. However C++ bindings is far away. It makes me wonder whether learning Gtk+ is worth it.
I've used GTK and Qt in C++ and also PyGTK and PyQt in Python quite extensively.
Qt beats GTK hands down - its a much more flexible, modern and clean API. GTK is also lacking some features that are important to me. From a framework point of view, I'd recommend Qt.
As for langauge bindings (I can only speak about Python, since I've never used the Ruby equivalents), I think PyGTK (using Glade and a wrapper like Padraig Bradys libglade) make GUI programming insanely easy and fun. However, if you can GPL your software (or pay the license fee), then PyQt is also a good option, and while not quite as friendly as PyGTK + Glade (in that with GTK you can define your UI in Glade as a separate XML file, so you can tweak the UI without touching code; in Qt if you want to use QtDesigner, you have to generate code using uic, if I remember correctly) the API itself is really really nice to use and mirrors the Qt frameworks clean design very closely.
Over all, I'd probably recommend using PyQt over PyGTK, but I may be biased since I much prefer Qt over GTK nowadays, though you could try both out and see which you prefer - they are both almost trivial to get working.
If you are looking for a great book on PyQt, I'd recomment Rapid GUI Programming qith Python and Qt.
To summarize: IMHO Qt beats GTK in both quality and capability. Both PyGTK and PyQt are of excellent quality and capability mirrors the underlying framework, though PyGTK can load Glade xml files.
I think that GTK bindings are older than Qt ones (and so a bit more mature) but they are both usable and your previous knowledge of Qt should be the main factor in your choice.
I developed small GUIs using both Qt and GTK with their python bindings and found the two equivalent. Some regrets though on the PyQt bindings with Qt container (QVector, ...) that are not translated into regular python data structure and thus add a bit of complexity to the code. I didn't recall the same issues using PyGTK.
I have worked with both PyQt and PyGTK and I would say they're both regularly mantained and synched with their parent frameworks. However, and this is completely subjective, I found more rewarding working with PyGTK than with PyQt, even if I hadn't previously written any code using GTK. If you know well Qt, go with Qt though.
I have been trying a few combinations around Qt : RubyQt, JRuby + Jambi, PyQt. The first one quickly ends up in various segmentation-faults. My Qt skills may be the problem but all in all the seg faults are not quite readable. The forum for RubyQt is nearly dead so don't expect to find much information there.
So I moved to JRuby + Jambi. This worked until well, I reached some missing functions here and there. Plus I had to implement a proper signal/connect for JRuby. So, more or less a hack. Not convincing.
Finally I moved to Python (wich I don't like very much). But woooh, what a difference. Bindings are up to date, I have still to ecnounter a segmetatio fault, error messages are most of the time very explanatory. So as far as I'm concerned Python+Qt is a clear winner.
Please note that I was trying these combinations in order to find a proper language/qt binding so that I can create a production ready with my commutation hours (roughly 2 hours a day). So my tolerance to small-but-annoying problems such as segmentation faults is 0. I also have to develop on Windows and Linux. So Windows installation is necessary (and once again, Python is a clear winner here).
there are C++ gtk+ bindings. Google for gtkmm.

Any really modern, good-looking desktop apps that are developed with PyQt/PySide?

I have started using Python for web development recently, it's kinda cool;
I have seen programs that are developed in QT/C++, which is good enough in terms of esthetics;
I have just noticed the new PySide project (which brings LGPL Qt license to Python and it doesn't support Windows yet).
In view of the above, I see the possibility of using Python + PyQt/PySide to develop cross platform apps in the future :) but I have several doubts right now:
Can PyQty/PySide be used to develop really complex/modern UI? Can somebody give me some points to have a look at some nice-looking screenshots of apps that are developed in Python+QT?
What about the performance of using Python + QT for a desktop app?
Thanks in advance!
Can PyQty/PySide be used to develop really complex/modern UI?
Desktop applications come in all sorts of varieties -- some nicely laid out, some extremely customized with virtually no semblance to a standard application for that OS. The same can be done with Qt/PyQt/PySide. As Alex said, there should be no visible difference between an application written with PyQt/PySide versus one written with Qt in C++. Any program written with Qt4 (using bindings or not) will, by default, look like a standard modern application.
Of course, there are features of recent Windows releases (and likely some on Mac OS X) that aren't supported immediately and by default in Qt, but you can almost always write some custom platform specific code for those situations where said features are truly important.
Can somebody give me some points to have a look at some nice-looking screenshots of apps that are developed in Python+QT?
The best and most open source program that I know of and which is written with PyQt, is Eric -- a Python based IDE.
What about the performance of using Python + QT for a desktop app?
For most applications the performance difference between a C++ Qt application and a PyQt application are not noticible. But if you really need performance, you can write certain parts of the application in C++ and make bindings available in Python so you can integrate the two.
TortoiseHg was re-designed using Qt and PyQt for its 2.0 release.
Here is one of several posted screenshots:
There is no aesthetic difference between the look and feel of C++ based Qt, and the PyQt and PySide wrappers on top of it. I use basically no desktop GUI apps so I couldn't point you to any implemented with any of these language/toolkit combos, but if you like the former, you'll be hard put to distinguish it in any way from the latter.
A bit late but for the record, apps such as Skype, GoogleEarth or the recent versions of VLC (media player & more) used the Qt libs.

Jdesktop or Qt for better Desktop application

I will make a desktop application. I searched on web which one is better. Can someone say positive and negative sides of these components.
I can add some information about QT:
QT is a well designed, portable library that covers nearly everything you'll need for a desktop application. QT covers GUI, networking, SQL, Graphics and more.
Pros:
very extensive library
high performance
portable
Cons:
It's C++
special preprocessor / make tool needed.
Setting up a QT compile environment is a little bit more difficult than setting up a C++ compile environment. C++ is - especially if you are not used to it - very difficult and the learning curve is steep. QT helps alot with appropriate helper classes (QPointer, ...) and library magic (QObjects freeing children, ...) in the background. There are bindings to other languages as well. Just to mention a few - Jambi is a binding for Java and there's a binding for python as well.
For your decision consider the following things
which programming language do you know best
which libray reduces your amout of work for this application the most
how much performance do you REALLY need. C++ code can be very fast, but there's no reason to work with manual memory management and pointers if you don't need the performance.
which library offers you the look and feel you want to have for your desktop application
If you need portability: Do you want to "compile once run everywhere" (Java) or do you want to "run your app everywhere once you compiled it for this plattform" (QT)
Here's the link to QT-Jambi Wiki: http://qt.gitorious.org/qt-jambi/pages/Home. According to Nokia: "Qt Jambi is the Qt GUI toolkit for Java developers"
Qt is the best cross platform GUI framework at the moment. It renders the widgets with a native look on each platform and it has a very easy to use API.
Using Qt doesn't mean that you have to use C++. You can program Qt in Java (Qt Jambi) or Python (PyQt) for instance.

Resources