Gui 工具包,我应该使用哪个?

2021-12-09 00:00:00 user-interface qt wxwidgets c++

我正在编写一个相当大且复杂的数据分析程序,我已经到了我认为是时候为程序构建 GUI 的时候了.所以我的问题是:

I am writing a fairly large and complex data analysis program and I have reached the point where I think it is about time to build a GUI for the program. So my question is:

我应该使用哪个 GUI 工具包?

Which GUI toolkit should I use?

我对编码和构建 GUI 完全陌生,希望能提供任何指导.它不必是世界上最简单的工具包,我学得相当快.但是,它确实需要能够执行以下操作(如果不是全部的话,对于任何给定的工具包来说,如果不是全部的话,其中一些可能是非常基础的,但我认为最好将所有这些都扔掉以防万一).

I am completely new to coding and building GUIs and would appreciate any guidance that can be offered. It doesn't have to be the simplest tool kit in the world, I learn rather fast. However, it does need to be able to do the following things (some if not all of these are probably incredibly basic for any given toolkit but I thought that it would be good to throw all this out there just in case).

它必须允许我直接在屏幕上绘制,以便我可以将图形(实际上是光谱)、绘图和类似的东西放到用户面前.我需要能够收集有关他们点击上述光谱的位置的位置信息.我需要能够显示文本并从用户那里获取文本输入.它需要能够生成菜单(您知道文件、编辑等).如果它有一些内置的小部件来生成表格,那会很方便(尽管如果我可以直接在屏幕上绘制,我可以克服它的不足).它需要能够弹出警告、对话框、保存和打开框等.差不多就是这样,当我写出它们时,其中大部分看起来都很基本,但我不想让 GUI 部分编码和然后意识到我需要用不同的工具包重写它.

It has to allow me to draw directly to the screen so that I can put graphs (spectra really), plots and things like them up for the user to see. I need to be able to collect position information on where they clicked on aforementioned spectra. I need to be able to display text and take text input from the user. It needs to be able to generate menus (you know File, Edit, etc). If it were to have some built in widget for generating tables that would be handy (though I can surmount a lack of that if I can draw directly to the screen). It needs to be able to pop up warnings, dialogue boxes, save and open boxes, etc. That is pretty much it, most of these seem pretty basic when I write them out but I don't want to get the GUI partly coded and then realize that I I need to rewrite it with a different toolkit.

应该注意的是,我已经用 C++ 编写了这个程序,我不想必须用 C 或其他东西来编写 GUI 部分,所以工具包需要支持 C++.

It should be noted that I have written this program in C++ and that I don't want to have to write the GUI part in C or something else so the toolkit needs to support C++.

此外,跨平台工具包比单一平台工具包更可取.但是,如果它必须是一个单一平台的工具包,那么我更喜欢它用于 Linux.

Additionally a cross platform toolkit would be preferable over a single platform toolkit. However if it must be a single platform toolkit then I would prefer it be for Linux.

最后,与闭源工具包相比,我更喜欢开源工具包.

Finally, I would DRAMATICALLY prefer an open source toolkit to a closed source toolkit.

除此之外,我想不出要补充的内容.提前感谢您的时间和答案.

Beyond that I cannot think of anything to add. Thank you in advance for your time and answers.

嗯,根据答案,我将同时查看 Qt 和 wxWidgets,看看哪个更吸引我.我可以接受多个答案,但我不能接受,而且由于我正在考虑两件事,因此只接受其中一个答案是不公平的,也许在一两周内,然后我查看了工具包并认为我想用哪个.

Hmmm based on the answers I shall look at both Qt and wxWidgets and see which appeals to me more. I with I could accept multiple answers as accepted but I can't, and since I am looking at two things it would be unfair to only accept one of the answers, perhaps in a week or two then I have looked at the toolkits and figured out which I want to use.

推荐答案

对于 C++,在我看来,Qt 是最不令人沮丧且功能最齐全的工具包.它也完全跨平台.请注意,Qt 将在 2009 年 3 月的某个时间获得 LGPL 许可,届时 4.5 版可用.目前,它仅以 GPL 和商业许可版本提供.

For C++, in my opinion, Qt is the least frustrating and most fully featured toolkit. Its also fully cross platform. Note that Qt will be LGPL licensed some time in March 2009, when version 4.5 becomes available. Currently, its only offered in a GPL and commercial license version.

Qt 的 GUI 设计器很好.它有很多实用功能(场景图库、翻译支持、内置Javascript引擎、内置WebKit库).通过 MOC(一种特殊的预编译器),它还为 C++ 带来了一些运行时绑定功能和内省.

Qt's GUI designer is good. It has lots of utility functions (scene graph library, translation support, built-in Javascript engine, built-in WebKit library). Via the MOC (a special pre-compiler) it also brings a few run-time binding capabilities and introspection to C++.

对于您的技术应用程序,您可能会发现 Qwt (http://qwt.sourceforge.net/)提供您所需要的.它建立在 Qt 之上.

For your technical application, you might find that Qwt (http://qwt.sourceforge.net/) provides what you need. It is built upon Qt.

如果您想要 Qt 的实用程序支持(例如网络等)而无需 GUI,则它甚至可以无头"使用.

Qt can even be used "headless" if you want its utility support (such as networking, etc) without a GUI.

另一个跨平台的 C++ 选项是 wxWidgets,它可用但与 Qt 没有真正的可比性.它是一个低得多的工具包,并不容易使用或全面.Gtkmm 是另一种选择,本着 GTK+ 的精神.

The other cross platform C++ option is wxWidgets, which is usable but not really comparable to Qt. Its a much lower level toolkit, and isn't as easy to use or fully rounded. Gtkmm is another option, in the spirit of GTK+.

相关文章