Gu为KDE和Gnome [重复]

时间:2021-08-07 07:05:28

This question already has an answer here:

这个问题在这里已有答案:

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.

我想给一个应用程序写一个gui,这个应用程序现在是需要在KDE和Gnome DE中“看起来很好”的CLI,它充分利用了用户设置的外观。

If I select Qt or GTK+ will I be able to do this?

如果我选择Qt或GTK +我能做到吗?

Do they integrate well with both DE's? Or does a KDE user need gnome libs and vice versa to run them?

他们是否与两个DE很好地融为一体?或者KDE用户是否需要gnome libs,反之亦然?

My development language of choice will be C++

我选择的开发语言是C ++

3 个解决方案

#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.

你可以静态编译和链接到Qt(我在Windows上看过这个,不知道它在Linux上是如何工作的)。 Qt应用程序可以通过使用qgtkstyle在GNOME桌面环境中看起来是原生的。

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.

wxWidgets使用GTK +,如果你想让它在KDE上看起来不错,你需要有一个GTK主题,它使用Qt进行渲染,如qgtkstyle用于GNOME。 qgtkstyle被纳入Qt,而另一个选项来自第三方。

#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.

我发现Gtk +应用程序在KDE中看起来比在Gnome中的Qt应用程序更接近,但不够重要。这两个选项看起来和感觉都属于它们,前提是这些库在系统上可用(您可能会更常见)或者它们是静态链接的(不确定Qt是否允许这样),如上所述。

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:

其次,wxWidgets仍将在KDE中使用Gtk +,需要加载相同的库,就好像你使用Gtk +严格编写应用程序以及wxWidgets一样。它确实是一个很棒的选择,因为它易于使用并且在许多环境中都能很好地工作。这可以让您了解应用程序在桌面环境之间的外观:

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.

我认为更重要的是哪种更适合您的编码风格和应用。在许多方面,Qt和Gtk +可能完全不同。

#3


Krish is right !

克里什是对的!

If your aim is to make a cross-platform application, use a library like wxWidgets.

如果您的目标是制作跨平台应用程序,请使用类似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.

例如,如果您决定使用Qt,那么在Gnome上运行的用户将下载一些库并且它将正常工作。当分发具有包管理器时,这是透明的,但如果没有,则更加困难。

#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.

你可以静态编译和链接到Qt(我在Windows上看过这个,不知道它在Linux上是如何工作的)。 Qt应用程序可以通过使用qgtkstyle在GNOME桌面环境中看起来是原生的。

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.

wxWidgets使用GTK +,如果你想让它在KDE上看起来不错,你需要有一个GTK主题,它使用Qt进行渲染,如qgtkstyle用于GNOME。 qgtkstyle被纳入Qt,而另一个选项来自第三方。

#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.

我发现Gtk +应用程序在KDE中看起来比在Gnome中的Qt应用程序更接近,但不够重要。这两个选项看起来和感觉都属于它们,前提是这些库在系统上可用(您可能会更常见)或者它们是静态链接的(不确定Qt是否允许这样),如上所述。

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:

其次,wxWidgets仍将在KDE中使用Gtk +,需要加载相同的库,就好像你使用Gtk +严格编写应用程序以及wxWidgets一样。它确实是一个很棒的选择,因为它易于使用并且在许多环境中都能很好地工作。这可以让您了解应用程序在桌面环境之间的外观:

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.

我认为更重要的是哪种更适合您的编码风格和应用。在许多方面,Qt和Gtk +可能完全不同。

#3


Krish is right !

克里什是对的!

If your aim is to make a cross-platform application, use a library like wxWidgets.

如果您的目标是制作跨平台应用程序,请使用类似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.

例如,如果您决定使用Qt,那么在Gnome上运行的用户将下载一些库并且它将正常工作。当分发具有包管理器时,这是透明的,但如果没有,则更加困难。