Home » C++ » GUI development: Qt vs GTK [closed]

GUI development: Qt vs GTK [closed]

Posted by: admin November 29, 2017 Leave a comment

Questions:

I’m new to programming with graphic user interface. I code mostly in C++ and I need my code and GUI to be OS independent so after doing some research I just can’t decide between Qt or GTK. I read that GTK is more memory efficient but some sites said it was before Qt 4. Also Qt has the Qt creator IDE which I think is a wonderful IDE for C++. ¿Anyone knows more about the pros and cons of each one? Thanks

Answers:

Yay, another Lib_One vs Lib_Two kind of questions. I love answering these.

Requirements

Firstly, there is no perfect magical toolkit that fits everyone’s needs. Your choice should be based on what you are trying to do.

  • Do you just want a GUI Toolkit? Or do you want a complete application development framework with APIs for Graphics, Sound, Image IO etc. ?
  • Are you targeting a specific platform?
  • Do you need extra eye candy?
  • What does your client want?
  • Are you targeting embedded systems or the PC?

Gui Toolkit

Both GTK+ and Qt are considerably mature Object Oriented GUI Toolkits. They are both open-source, cross-platform and have large active communities. GTK+ is used as the standard toolkit for the GNOME, LXDE and Xfce Desktop Environments while Qt is used for KDE. Both have been used for developing professional applications and are time-tested.

Cross-Platform Compatibility

Both toolkits support almost all mainstream PC Platforms.

Platforms Supported By Both:

  • Windows XP
  • Windows Vista
  • Windows 7
  • Mac OS X
  • Linux / Unix

In addition Qt also supports:

  • Symbian S60
  • Windows CE
  • WebOS
  • Android
  • Ubuntu Phone

Performance

This is seriously debatable. GTK+ evangelists point to the high memory consumption of Qt apps, while Qt fans jeer at the GTK runtime’s start-up time. But overall, there isn’t any great difference. Both run fast enough on modern PCs.

Proprietary Use & Language Bindings

GTK+ is LGPL licensed so it can be used for proprietary apps. Qt is triple licensed with LGPL, GPL and a proprietary license. If you use LGPL or buy the proprietary license, you can use Qt for proprietary apps.

Both Toolkits have bindings for all popular languages. Notable bindings include GTK#, the C# Binding for GTK+, which has been endorsed by the Mono Project. And Qt-Jambi, the Qt binding for Java, which is actively updated.

Resources

Both toolkits are extensively documented. With GTK+ having its own documentation ( GTK-Doc ), and Qt being documented by Nokia. However Qt may have a slight edge here because it has the huge resources and manpower of a huge corporation behind it (Nokia), while GTK+ is only documented by its contributors. There are tutorials on many places on the internet for both of them. I prefer ZetCode.

Conclusion

As you can see both of them are more-or-less good enough. The choice really depends on the point I made earlier: what are your requirements?