MTE Explains: Desktop Toolkits, GTK+ and Qt

If you have been using Linux for quite a while, you will probably have seen some applications that are based on Qt or GTK+. So what exactly are these? Does it make any difference whether you are using Qt or GTK+ based application?

Modern GUI applications require a number of standard interactions (e.g. “open file” or “make this window smaller”), and users have come to expect that they’ll perform these actions through standard mechanisms. For example, opening a file should be done with a dialog box that allows the user to browse and click to select the file, rather than making the user enter the full file path name. Likewise, resizing a window should be done through clicking a button on the title bar of the window or clicking and dragging one of the window’s sides.

One thing Desktop Toolkits do is provide these “standard” functions, so developers don’t need to implement them from scratch (i.e. a developer creating a text editor doesn’t need to draw all the fields and buttons for an “Open…” dialog from scratch, nor code the instructions to allow the user to browse for a file). As an additional bonus, programmers using these toolkits can make their applications consistent with others using that toolkit. And in the computer world, consistency is always a good thing.

toolkits-wxwidgets-grid

In the Linux’s world, there are several desktop toolkits that are actively being used by the developers. GTK+ and Qt are two of such toolkits. The good thing about these toolkits is that they will work fine in different destkop environment. You can run Qt-based programs in GNOME, and apps built with GTK+ will work just fine in KDE. The main differences will be in how some of the elements behave (file selection dialogs might look quite different between Qt/KDE and GTK/GNOME applications), although developers have found some way to minimize these differences. For example, KDE includes a Control Center module to make things like the title bars and other style/theme elements for GTK apps match those of the Qt-based ones.

Qt (commonly pronounced “cute”) began in 1991 by a pair of developers who eventually found Trolltech (which was in turn bought by Nokia, then the commercial rights sold to Digia). Qt first came to prominence as the foundation of the K Desktop Environment, which most users know today as the KDE Software Collection. The more modern look of Qt compared to other toolkits at the time (it was common in the late 1990’s to still use applications written in Motif or even Xaw, which while still functional, were looking rather dated) set KDE on track to become the desktop environment for Unixes, including Linux.

toolkits-qtdesigner

However, some community members took exception to Qt’s licensing, which at the time included restrictions from redistributing modified versions. The debates went on, and the result was the decision to create a new, completely free toolkit.

Some well known Qt-based apps for Linux, in addition to every program in the KDE Software Collection, include popular media player VLC, robust desktop-publishing application Scribus, and the Calibre e-book management program.

GTK+ takes its name from the GNU Image Manipulation Program (aka. GIMP), which is a standard alternative to Adobe Photoshop on many platforms. Its developer had started writing a custom set of widgets, which the community adopted for a new desktop environment: the GNU Network Object Model Environment, (aka. GNOME). The rivalry between these two desktops had gone on for years, until the recent entry of Canonical’s Unity took some of the heat away from them. GNOME has also spawned its own controversy, with some so dissatisfied with the experience of new releases in the 3.0 series that forks and modifications such as MATE and Cinnamon have come up.

toolkits-gnome

In addition to GIMP, other popular Linux applications using GTK+ are the Chromium browser (which is used to produce the Linux version of Google Chrome), multi-protocol instant messenger Pidgin, and other desktop environments such as MATE and LXDE.