What is difference between GTK and Qt?

GTK vs Qt

GTK+ and Qt (only on Linux) are open-source cross-platform User Interface toolkits and development frameworks. These are the two most popular frameworks in use for Linux and BSD because they are open-source and give developers a powerful toolkit to design Graphical User Interfaces. Qt is C++ based but it uses C++ in its own way because of its cross-platform nature (through a special preprocessor) and GTK is C based but it uses its own “object oriented” approach but has bindings for just about every popular language in use today.
Sometimes, when you install a new softwares you will see GTK+ or Qt on they name. What is it? What is difference between GTK+ and Qt? For the applications I have experienced with, I don’t think there’s a difference in quality between QT and GTK applications, just as Evolution, ThunderBird…

GTK vs Qt
GTK vs Qt

Overview

Qt is developed by an open community around Qt Software, a division of Nokia. Qt Software was originally named Trolltech before being acquired by Nokia in 2008. GTK+ was originally created to develop GIMP and is now developed and maintained by the GNOME Foundation.
GTK+ (GIMP Toolkit) is a cross-platform widget toolkit for creating graphical user interfaces. It is one of the most popular toolkits for the X Window System, along with Qt. GTK+ was initially created for the GNU Image Manipulation Program (GIMP), a raster graphics editor, in 1997 by Spencer Kimball and Peter Mattis, members of eXperimental Computing Facility (XCF) at University of California, Berkeley.
GTK+ is used as the standard toolkit for the GNOME, LXDE and Xfce Desktop Environments while Qt is used for KDE. So, you can choose GTK+ or Qt softwares to install into your OS for more compatible. Qt looks more native than GTK+ on Windows and Mac platforms.

License

There are three editions of Qt available on each of these platforms, namely: GUI Framework (formerly known as “Desktop Light”), Full Framework, Open Source that mean it is available under the following copyright licenses: GNU LGPL 2.1 Version, GNU GPL 3.0 Version with Qt special exception and Commercial Developer License.
GTK+ is licensed under the GNU LGPL 2.1 allowing development of both free and proprietary software with GTK+ without any license fees or royalties.

Performance

GTK+ proponents say that GTK+ uses less memory than Qt. The difference, however, is negligible according to Qt advocates. The reason some people are seeing Qt hogging memory is mostly that they’re using an old version of the gcc compiler — it used to be very inefficient at generating C++ code especially for advanced features such as templates and exceptions. These problems have long been fixed; with gcc 4.4, Qt typically does not use more memory than GTK+.

Using

Both Qt and GTK+ are available on most popular desktop Operating Systems. Qt can run on almost platform with recompilation and GTK can work on Windows and Mac with some ported version, the newest version of GTK always runs on Linux/Unix environment. Don’t like Qt, GTK+ on embedded devices (e.g. Meego) requires an X11 server + window manager, resulting in at least three processes running for an application.
Those desktop environments are not required to run GTK+ programs. If the required libraries are installed, a GTK+ program can run on top of other X11-based desktop environments or window managers; this includes Mac OS X if X11.app is installed (which is the default since the Leopard release). GTK+ can also run under Microsoft Windows, where it is used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI toolkit, uses GTK+ for Unix systems.

Development

If you’re an experienced developer you know how valuable a true Integrated Development Environment (IDE) can be to your productivity. While many of the more modern development strategies include building test cases before you write the actual code, there is no substitute for a good debugging tool when you’re trying to track down a problem. Both GTK+ and Qt have supporting IDEs to help you get the job done.
Qt can rely on QtDesigner and KDevelop that, together, make up a real IDE (similar to Visual Studio) while GTK must rely on Glade only, that is a GUI builder equivalent to QtDesigner. There is nothing like KDevelop for GTK+
GTK is simply more tempting to developers. Why? Because there’s no payback to building a great standalone Qt-app. It won’t get included as default in a major distribution anyway. Here’s the reasoning: lightweight distributions will invariably choose GTK, because it’s possible to do so without pulling in all of GNOME. Just look at all the examples in Distrowatch’s list: Puppy, Vector, Damn Small Linux, Zenwalk, Wolvix…all distributions which aim to be lightweight and speedy, and all of them GTK. There’s not one lightweight Qt distribution, because building one is simply impossible. Install the wrong application and it pulls in the whole of KDE as a dependancy.
The actual process of building a graphical user interface (GUI) with both GTK+ and Qt is very similar. Both use a similar approach to widgets, layouts and panels. Each platform has tools to visually create your design. At the end of the day it’s probably a wash as to which choice would be easier from this perspective.

Native Languages

Natively, Qt has C++ based libraries. It also supports Java (officially supported in the past, but not anymore), Perl, Python, PHP, and Ruby based development. Qt also ships with the embedded scripting language QtScript, which is an ECMA-Script (JavaScript) implementation.
Natively, GTK+ has C based libraries. It supports several languages like for example C++, Java, Perl, Python, PHP, Ruby, JavaScript, and Mono/C#.
GTK+ applications can also be developed with Vala, an object oriented programming language similar to C#, specially designed for the GObject type system. Vala programs compile to C code, without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
Python bindings: Mature and actively-developed LGPL bindings exist for both GTK+ (PyGTK) and Qt (PySide). The creation of PySide was funded by Nokia to provide free bindings (mostly) compatible with the more restrictively, GPL-licensed free version of PyQt. Binaries are available for Linux, OS X and Windows.

Conclusion

Creating a complex GUI-based application is not an easy task. Building that application using a computer language you’re unfamiliar with and a development environment you’ve never seen is a recipe for failure. Choosing familiar tools and languages will help give your project a leg up on a successful outcome. If you don’t have to write your application in C or C++ to take advantage of either of these toolkits. Both have support for many of the more popular languages in use today.
In the final analysis it comes down to picking the tool you’re most comfortable with and sticking with it.

Filed under: Desktop EnvironmentTagged with: ,

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Comment *
Name *
Email *
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.