适用于 KDE 和 Gnome 的 GUI
我想为现在的 CLI 应用程序编写一个 gui,该应用程序需要在 KDE 和 Gnome DE 中“看起来不错”,充分利用用户的外观设置。
如果我选择 Qt 或 GTK+ 我能够做到这一点吗?
它们与两个 DE 集成良好吗? 或者 KDE 用户是否需要 gnome 库才能运行它们,反之亦然?
我选择的开发语言是 C++
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++
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以静态编译并链接到Qt(我在Windows上见过这个,不知道它在Linux上是如何工作的)。 通过使用 qgtkstyle,Qt 应用程序可以在 GNOME 桌面环境中看起来像原生应用程序。
wxWidgets 使用 GTK+,如果你想让它在 KDE 上看起来不错,你需要有一个使用 Qt 进行渲染的 GTK 主题,就像 GNOME 的 qgtkstyle 一样。 qgtkstyle 已合并到 Qt 中,而另一个选项来自第三方。
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.
我发现 Gtk+ 应用程序在 KDE 中看起来比 Gnome 中的 Qt 应用程序更接近正确,但还不够重要。 这两个选项看起来和感觉都像是它们所属的,前提是这些库在系统上可用(您可能认为更常见)或者它们是静态链接的(不确定 Qt 是否允许这样做),如上所述。
其次,wxWidgets 仍将在 KDE 中使用 Gtk+,需要加载相同的库,就像您除了 wxWidgets 之外严格使用 Gtk+ 编写应用程序一样。 它确实是一个绝佳的选择,因为它易于使用并且在许多环境中运行良好。 这应该可以让您了解应用程序在桌面环境之间的外观:
http://www.wxwidgets .org/about/screensh.htm
我认为更重要的是它更适合您的编码风格和应用程序。 Qt 和 Gtk+ 在很多方面都有很大不同。
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.
克里什是对的!
如果您的目标是制作跨平台应用程序,请使用像 wxWidgets 这样的库。
例如,如果您决定使用 Qt,则在 Gnome 上运行的用户将下载一些库,并且它会正常工作。 当发行版有包管理器时这是透明的,但如果没有包管理器则更困难。
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.