GTK+ or Qt under Windows [closed]

2019-02-01 21:51发布

问题:

I was wondering which one should I consider if I need the software to be used on both platforms, WIN and Linux and why?

回答1:

Packaging GTK and its dependencies on Windows is a full-time project in itself. Qt is much more easily distributed since it has no dependencies that do not come with Windows.

Qt has been cross platform from the start. GTK has not always been cross platform. Such fundamental decisions shape the overall design, and should be made before any code is written in my opinion.

I would comment more, but I'd be drifting into speculation, the above two things I know for certain.



回答2:

Both are good toolkits that have their advantages and disadvantages.

One difference is the implementation language. Qt is in C++, and GTK+ is in C. However GTK+ has bindings for many, many other languages (perl, python, C++, .NET, etc) so it's not a huge issue.

An Advantage of Qt is that it offers a bit broader range of functionality built in (xml, database access, network programming, openGL, etc). GTK+ has basically all of these things within its orbit (e.g. libxml2, librsvg, libsoup, libgda, etc), but they're not as much of a single coherent package as Qt is.

My personal recommendation is to use gtkmm, the C++ bindings for GTK+. It offers a more comfortable object-oriented language to program in, and it provides nearly the same native performance as using GTK+ from C. (Disclaimer: I contribute to gtkmm).



回答3:

GTK+ you can use almost in all programming languages, in C++ (using gtkmm) in C (gtk+) in C# (with Gtk#) in Python (PyGtk). Behind GTK you have Mono Framework which is great implementation of .NET Framework for cross platform purposes. If you want to use Gtk# you have great IDE (MonoDevelop) with a very powerful gui designer. You can take a look at www.mono-project.org. But still depends what do you want to build, you are looking just gui toolkit, or the entire framework? And the logic behind signals/slots are the same in Gtk+ and Qt, but if you are using Gtk# they are transformed in the delegates/events paradigm.



回答4:

my $0.02:

I've used Qt off and on for the last 4 years, and it's hands-down my favorite toolkit of anything I've tried (Win32, MFC, Borland, Java, GTK). I used GTK for a few weeks to try it out, and didn't like it. Mostly that was because I think it's awkward to use C instead of C++ for GUI apps on a PC... I do embedded work too, and I'd never use C++ on an 8051, but for a big GUI app I much prefer it. If you're going to try GTK, I'd suggest looking in to GTKmm, although I've never used it myself.



回答5:

You might also consider wxWidgets. I have never used any of them but when I was looking over the cross-platform toolkits it was the one I had decided to try.



回答6:

Three additional points in favor of Qt:

  1. Your project does not have to be GPL; there are many other open-source licenses available in the Qt GPL Exception, including BSD and LGPL.
  2. Qt's default theme on Windows does a much better job of blending in than GTK's Wimp theme.
  3. If you want to support Macs later, you'll have a much easier time with Qt.


回答7:

I would prefer Qt. As today, Qt is Open-source and free under more permissive, LGPL license. Qt is better ported for Windows and looks more native than GTK. Gimp on windows, for example, looks very strange, because most of its dialogs are not Windows dialogs. Qt can use native Window dialogs like Open/Save which makes it feel better as a framework. And yes, Qt is a framework, not only a GUI Widget. No, I am not advertising Qt here, as Qt have some strangeness for a windows user from development point of view, for example, Qt is Layout based while MFC / .NET are anchor based and Qt's Layout managers are sometimes strange. But if I have to choose between both GTK and Qt, I will select Qt. Also, now, Qt comes with very good IDE, Qt Creator, which is my default C/C++ IDE for all types of projects now (as Qt Creator can be used as such).



回答8:

They are both fine toolkits. I'd base my decision on the licensing. Qt requires that you pay for a license if you are using it in a commercial product wheras GTK does not.



回答9:

Qt 5.0 has won the war. I'm not a huge fan of C++ (I prefer plain old C), but I must admit that the Qt framework is amazing. Try to write a GUI program with GTK that runs on OSX, Linux, Windows (and soon iOS and Android) with native look-and-feel... Good luck !



回答10:

I recommend to use Qt because:

  • It's cross-platform and and covers wide range of operating systems (including mobile)
  • It is opensource and has a fast speed in getting better
  • It has the a nice GUI designer and a very capable IDE (Qt Creator)
  • The API design is excellent and easy to use
  • It has a great documentation which is easy to read
  • It has the Qt translation system which enables you to have a multilingual app
  • The GUI layout system where the widgets resize themselves according to a layout makes everything much easier
  • The QML gives you the power to create fantastic GUI with great graphics and animations
  • It has great support for networking and connectivity(socket, SSL, www, IPC, ...)
  • It has QTestLib for testing the code
  • It has many language binding if you don't want to use C++


标签: qt gtk