问题
I want to write a gui to an application that is now CLI that needs to "look good" in both KDE and Gnome DE's, taking optimal advantage of a users settings for appearance.
If I select Qt or GTK+ will I be able to do this?
Do they integrate well with both DE's? Or does a KDE user need gnome libs and vice versa to run them?
My development language of choice will be C++
回答1:
You can compile and link to Qt statically (I've seen this on Windows, don't know how it works on Linux). Qt applications can look native on GNOME desktop environment through the use of qgtkstyle.
wxWidgets uses GTK+, if you want to have it look nice on KDE you need to have a GTK theme which uses Qt for rendering like qgtkstyle is for GNOME. qgtkstyle is incorporated into Qt while the other option is from a 3rd party.
回答2:
I've found that Gtk+ apps come closer to looking right in KDE than Qt apps do in Gnome, but not by enough to matter. Both options look and feel like they belong, provided the libraries are available on the system (more common that you might think) or they are statically linked (not sure that this is allowed with Qt) as mentioned above.
Secondly, wxWidgets will still use Gtk+ in KDE, requiring the same libraries to be loaded as if you wrote the application strictly using Gtk+ in addition to wxWidgets. It really is a fantastic choice though as it's easy to use and works well in many environments. This should give you an idea of how applications will look between desktop environments:
http://www.wxwidgets.org/about/screensh.htm
I think what is more important is which will fit your coding style and application better. Qt and Gtk+ can be quite different in many regards.
回答3:
Krish is right !
If your aim is to make a cross-platform application, use a library like wxWidgets.
If you decide to use Qt for example, users running on Gnome will download some libs and it'll work fine. This is transparent when the distribution have a package manager but more difficult if it doesn't.
来源:https://stackoverflow.com/questions/1164204/gui-for-kde-and-gnome