GTK vs Qt

From WikiVS, the open comparison website
Jump to: navigation, search
GTK Qt
GTK
VS
Qt
http://www.gtk.org http://qt.digia.com

GTK+ and Qt 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. GTK+ is used as the standard toolkit for the GNOME, LXDE and Xfce Desktop Environments while Qt is used for KDE and Razor-Qt.

Contents

[edit] Development

Qt is developed by an open community around Qt Project, with main developers being Digia, KDE and many other users of Qt. Qt development team was originally known as Trolltech, then acquired by Nokia in 2008 and known as Qt Software.

GTK+ was originally created to develop GIMP graphical application and is now developed and maintained by the GNOME Foundation.

[edit] Usability

Qt was designed from the ground-up with object-orientation in mind. It uses a code generator called moc and uic to deliver features at higher-level than those available in C++ (signals, slots, object introspection, scriptability, GUI integration).

GTKmm, the C++ interface to GTK+, uses standard C++ templates. Unlike Qt APIs, GTKmm has been added on top GTK+ and thus was not designed from the ground-up. Because of this, it is said that GTKmm reflects some design decisions seen in the GTK+'s API for C.

[edit] Documentation

There is extensive documentation for Qt at the QtProject website.

GTK+ has documentation available both online and locally using the DevHelp system.

[edit] Framework

Both Qt and GTK+ were developed from the ground up with Object Oriented Programming in mind. Qt is developed in C++, GTK in C in an object oriented manner using the GObject type system. C++ bindings are available through gtkmm.

[edit] Coverage

Qt is a complete consistent framework. You can easily connect HTTP events to GUI elements, fill forms with results from a database query or build an interactive visualization of large datasets. Qt 4 modules include QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtOpenVG, QtScript, QtScriptTools, QtSql, QtSvg, QtWebKit, QtXml QtXmlPatterns, QtDeclarative, Phonon, Qt3Support. Modules for working with Qt tools are QtDesigner, QtUiTools, QtHelp, QtTest. Modules for Windows developers are QAxContainer, QAxServer. Module for Unix developers is QtDBus.

GTK+ is only a GUI toolkit, but can be seen as part of a GObject based library stack. It interoperates very well with other libraries such as GLib, GIO, GNet, GStreamer, Poppler, Pango, Cairo and Clutter.

[edit] Portability

Both Qt and GTK+ are available on most popular desktop Operating Systems. For mobile devices, Qt for Embedded allows Qt to run directly on the hardware, without the need of X11 or a window manager. The first Qt application started becomes the window manager featuring full composition and top-level transparency. GTK+ on embedded devices (e.g. Meego) requires an X11 server + window manager, resulting in at least three processes running for a hello world application.

OS Qt GTK+
Windows XP, Vista, 7 Native Native
Windows Mobile (CE) Native Not available
Mac OSX Native Native [1]
Linux/Unix (X11) Native Native
Linux/Unix (framebuffer) Native Native [2]
Linux/Unix (eglfs) Native Not available (GNOME extension exists [3])
VxWorks Native Not available
Symbian (S60 3rd edition and later) Native Not available
maemo 6 (Harmattan) Native Not available[4]
WebOS Native Not available
Android Native Not available
BlackBerry 10 Native Not available
Ubuntu Mobile Native Not available
SailFish OS Native Not available
AmigaOS Native [5] Not available
eComstation (os/2) Native Outdated
Haiku Native Not available

Qt GUIs look and behave more natively than GTK+ GUIs on Windows and Mac platforms. This is because Qt calls native painting primitives whenever possible and practical; but the native support is wrapped within just another style. Even so, neither Qt nor GTK+ will look and feel completely native on Windows or Mac because this is not feasible when portability is one of the design goals. Non-native OS-independent user experience can be achieved with both toolkits by setting one of their portable widget styles.

[edit] Performance

Both toolkits use similar amount of memory and CPU for similar tasks when traditional widgets are used. Differences demonstrated in old analysis come from the usage of old compilers or specific setups so are no longer valid. GTK+ has no equivalent of QtQuick APIs, runtime and tools. QtQuick outperforms GTK+ widgets in terms of performance of animations and transitions.

[edit] Native Languages and Language bindings

Natively, Qt has C++ based libraries. Its QtQuick module natively supports QML (Qt Modelling Language) for components creation. Many language bindings are delivered thanks to the SMOKE is a introspective wrapper. Qt supports Java [6]Template:Dead link (officially supported in the past, but not anymore [7]), Perl [8], Python [9] [10], PHP [11], and Ruby [12] based development. Qt 4 also ships with the embedded scripting language QtScript, which is an ECMA-Script (JavaScript) implementation. QtQuick 2 from Qt 5 ships Google's V8 JavaScript engine.

Natively, GTK+ has C based libraries. It supports several languages, notably including C++ [13], Java [14], Perl [15], Python [16], PHP [17], Ruby [18], Vala [19], JavaScript [20], and Mono/C# [21].

GObject libraries, the base for GTK+, have a tool to allow them to be available to any language supporting GObject-Introspection. Any library with a new release, can install its GIR (XML format) and Typelib files, to be available for bindings with no extra effort and by-hand created binding.

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 PyGObject) and Qt (PySide, PyQt). PySide was funded by Nokia to provide free bindings (mostly) compatible with the more restrictively, GPL-licensed free version of PyQt. PySide is now part of the Qt Project. Binaries are available for Linux, OS X and Windows.

[edit] Rivalries

A good example is when Nokia (previously focused on GTK+) announced that it will improve the co-operation with Trolltech (Qt)[22]. Motorola representatives announced they will focus more on the GTK+ toolkit [23] but that development has come to a stop.

In 2008, Nokia acquired Trolltech to get premium support in Qt for (then emerging) Nokia's mobile platforms such as new Symbian and maemo/MeeGo Harmattan, ditching GTK (and in case of symbian a home-brewn toolkit) as main development library for these devices. In 2009, Nokia adopted the LGPL for Qt. In 2011 qt-project.org went public with open collaboration and meritocracy rules, bringing its governance and licensing to the same level as GTK. The sales of the Qt department in Nokia (with the trademark and most developers) to Digia has so far not impacted this and development has picked up steam.

Thanks to the advanced features of Qt5 (especially QML) and GTK development being in flux and very strongly focused around the needs of GNOME, various third party projects are moving over to Qt5. Ubuntu builds on Qt and QML for Ubuntu Phone and will move over the desktop in the future, the LXDE desktop and GCompris projects are the process of porting over and Subsurface (a project which famously has Linus Torvalds as core contributor) has had its first Qt based release. LXDE provides extensive tips on the migration process.

[edit] Size of development teams

According to Ohloh, GTK has about 210 contributors adding around 3000 commits a year. Qt, with the development focus moving from Qt4 to Qt5 and having introduced open governance only in 2011, is a bit harder to measure. Qt4, in maintenance, sports a contributor number comparable to GTK, but has only about 1700 commits in the last 12 months. Development has clearly moved to Qt5 where the over 400 contributors committing a staggering 15780 commits in the last year reflects the fact that the majority of Qt developers works full-time on the tool kit, while GTK+ depends more strongly on volunteer contributions.

During the year, GTK hovers around 25 contributors per month, Qt5 has a little over active 100 coders adding their change sets in the same time, contradicting the starkly negative wake-up call GTK maintainer Benjamin Otte wrote claiming that GNOME has 20 core hackers at most and GTK is down to one paid developer — himself. Both tool kits are still actively maintained and developed and also have many non-core libraries providing additional features and functionality to the ecosystem, with GTK building on glib, Clutter and more while Qt stands to benefit from the work in splitting off the KDE Libraries to stand-alone, reusable parts with minimal dependencies in KDE's Frameworks 5 efforts.

[edit] Licenses

GTK+ is under the LGPL. This means that it can also be used by closed source applications in environments which support dynamic linking. Unlike with Qt, GTK+ has no license option to be extended or compiled into a closed source code. This option is enabled to Qt which has (within Qt Project) an agreement with Digia, who provides Qt under the terms of a commercial licensing agreement. This version of Qt is called Qt Commercial.

Qt is available under the terms of the GNU Lesser General Public License (LGPL) version 2.1. This version of Qt is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions.[24]

[edit] Links

See Also the Following Articles

Personal tools
Namespaces
Variants
Actions
Navigation
Ads
Toolbox