GTK vs Qt - WikiVS

来源:百度文库 编辑:神马文学网 时间:2024/05/23 12:36:52

From WikiVS, the open comparison website

Jump to: navigation, search


GTK Qt VS http://www.gtk.org http://qt.nokia.com

GTK+ and Qt are open-source cross-platform UserInterface toolkits and development frameworks. These are the two mostpopular frameworks in use for Linux and BSD because they areopen-source and give developers a powerful toolkit to design GraphicalUser Interfaces. GTK+ is used as the standard toolkit for the GNOME andXfce Desktop Environments while Qt is used for KDE.

Contents

[hide]
  • 1 Development
  • 2 Usability
    • 2.1 Design Tools
    • 2.2 Documentation
    • 2.3 Framework
    • 2.4 Coverage
    • 2.5 Portability
  • 3 Performance
  • 4 Native Languages and Language bindings
  • 5 Rivalries
  • 6 Licenses
  • 7 Links
  • 8 Vote

[edit] Development

Qt is developed by Qt Software, a division of Nokia. Qt Software wasoriginally 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.

[edit] Usability

Qt's API is said to be cleaner and better documented than GTK+'s.

Qt uses a code generator called MOC.

GTKmm, the C++ interface to GTK+, uses standard C++ templates.

[edit] Design Tools

With GTK+, many people use Gladeto easily construct the GUI visually and then code the callbacks. Theproblem with Glade is that it brings one more library dependency.GtkBuilder, which is included in GTK+, is a substitute for Glade. It isrecommended by GTK+ developers to use GtkBuilder over Glade. Nowdevelopers can design a GUI in Glade Designer and convert them toGtkBuilder XML using converter utility in Makefile.

Qt has Creator,which functions both as an IDE and also seamlessly incorporatesDesigner, a tool that allows easy layout of widgets and simpleconnections of slots and signals between widgets.

[edit] Documentation

Trolltech has extensive documentation for Qt.

GTK+ is lacking in documentation compared to Qt.

[edit] Framework

Both Qt and GTK+ were developed from the ground up with ObjectOriented Programming in mind. Qt is developed in C++, GTK+ in C in anobject oriented manner using the GObject type system. C++ bindings areavailable through gtkmm.

[edit] Coverage

Qt is a complete consistent framework. You can easily connect HTTPevents to GUI elements, fill forms with results from a database queryor build an interactive visualization of large datasets.

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

[edit] Portability

Both Qt and GTK+ are available on most popular desktop OperatingSystems. For mobile devices, Qt for Embedded allows Qt to run directlyon the hardware, without the need of X11 or a window manager. The firstQt application started becomes the window manager featuring fullcomposition and top-level transparency. GTK+ on embedded devices (e.g.Maemo) requires an X11 server + window manager, resulting in at leastthree processes running for a hello world application.

OS Qt GTK+ Windows XP Native Native Windows Vista Native Native Windows Mobile (CE) Native Not available Mac OSX Native Port available [1] Linux/Unix Native Native Symbian (S60) Native Not available

Qt looks more native than GTK+ on Windows and Mac platforms. This isbecause Qt tries to use native widgets whenever possible. Even so,neither Qt nor GTK+ will look and feel completely native on Windows orMac. From the other hand GTK+ brings more consistent user experiencewhen switching from one platform to another, since Look And Feelremains unchanged.

[edit] Performance

GTK+ proponents say that GTK+ uses less memory than Qt. Thedifference, however, is negligible according to Qt advocates. Thereason some people are seeing Qt hogging memory is mostly that they'reusing an old version of the gcc compiler - it used to be veryinefficient at generating C++ code especially for advanced featuressuch as templates and exceptions.These problems have long been fixed; with gcc 4.4, Qt typically doesnot use more memory than GTK+.

[edit] Native Languages and Language bindings

Natively, Qt has C++ based libraries. It also supports Java [2] (officially supported in the past, but not anymore [3]), Perl [4], Python [5] [6], PHP [7], and Ruby [8]based development. Qt also ships with the embedded scripting languageQtScript, which is an ECMA-Script (JavaScript) implementation.

Natively, GTK+ has C based libraries. It supports several languages like for example C++ [9], Java [10], Perl [11], Python [12], PHP [13], Ruby [14], and Mono/C# [15].

GTK+ applications can also be developed with Vala,an object oriented programming language similar to C#, speciallydesigned for the GObject type system. Vala programs compile to C code,without imposing any additional runtime requirements and without usinga different ABI compared to applications and libraries written in C.

[edit] Rivalries

A good example is when Nokia (prior focused on GTK+) announced that it will improve the co-operation with Trolltech (Qt)[16]. Motorola representatives announced they will focus more on the GTK+ [17].

In 2008, Nokia acquired Trolltech to gain control of Qt. In 2009, Nokia adopted the LGPL for Qt.

[edit] Licenses

GTK+ is under the LGPL. This means that it can also be used byclosed source applications in environments which support dynamiclinking.

Qt is triple-licensed. For one it is available as GPL licensedlibrary which can only be used by open source projects with compatiblelicenses. But there is also a commercially available proprietarylicense, which allows for the development of closed source softwareusing Qt. Until recently, Qt required a proprietary license for use onMS Windows, but it has finally been made available under the GPL in itsMS Windows compatible version. The last license is the LGPL, whichNokia adopted in January 2009. The LGPL allows the free version of Qtto be included in software which isn't licensed under the GPL(proprietary software, or open source software released under adifferent licence).

[edit] Links

  • http://theunixgeek.blogspot.com/2007/10/gtk-vs-qt.html
  • http://www.staikos.net/~staikos/whyqt/
  • http://arstechnica.com/news.ars/post/20090114-nokia-qt-lgpl-switch-huge-win-for-cross-platform-development.html

A reasonably complete comparison at techfreaks: http://techfreaks4u.com/blog/?p=1021