简体   繁体   English

适用于C ++的小型本机跨平台GUI框架

[英]Small native cross-platform GUI framework for C++

I wrote a small program with Boost in c++. 我用C ++中的Boost写了一个小程序。 It works fine and so I want to give it a graphical interface so that it is easier to use. 它工作正常,所以我想给它一个图形界面,以便于使用。
In order to do so, I am looking for small cross-platform framework which provides native look and feel. 为了做到这一点,我正在寻找可以提供本机外观的小型跨平台框架。 Windows and Linux support would be enough, currently i do not need os x... Windows和Linux支持就足够了,目前我不需要os x ...

I used wxWidgets for some other project, but it was a pain to set everything up and ship this big library with the software. 我在其他项目中使用了wxWidgets,但要进行所有设置并随软件一起交付这个大库是一件很痛苦的事情。
But I was really amazed by the use of real native controls. 但是我对使用真正的本机控件感到非常惊讶。 In order to keep the program small I also tried fltk, but it has an awful look. 为了保持程序的小巧,我也尝试了fltk,但是它的外观糟透了。

I just need an simple framework without network support or other gimmicks. 我只需要一个没有网络支持或其他头的简单框架。

So my question: Is there any framework out there which fits all the requirements? 所以我的问题是:是否有适合所有需求的框架? Or if not, which frameworks fits at least some of these needs? 否则,哪种框架至少满足其中一些需求?

Thanks in advance! 提前致谢!

When it has the word "framework" in its name it's almost never small. 当其名称中带有“框架”一词时,它几乎不会很小。

Anyway, graphical frameworks/libraries tend to be big, cause they need to handle a lot of stuff. 无论如何,图形框架/库往往很大,因为它们需要处理很多东西。

Qt is probably the best straightforward library for cross-platform GUI, but it definitely doesn't constitute a "small framework". Qt可能是跨平台GUI最好的直接库,但它绝对不能构成“小型框架”。 On the other hand, on Linux systems, Qt will be most likely already installed. 另一方面,在Linux系统上,很可能已经安装了Qt。 Plus it definitely pays for its size. 加上它绝对是它的大小。

wxwidgets is fairly small as far as gui toolkits go. 就gui工具包而言,wxwidgets相当小。

And it's cross platform 它是跨平台的

http://www.wxwidgets.org/ http://www.wxwidgets.org/

You have mentioned it, but as far as cross platform toolkits go it's one of the smallest I've seen. 您已经提到了它,但是就跨平台工具包而言,它是我所见过的最小的工具包之一。

The only other suggestion I have is that you could wrap your code up into a C library and link that into another language. 我唯一的建议是,您可以将代码包装到C库中,然后将其链接到另一种语言中。 eg Use .NET on windows and mono for linux or even a java based app (although they don't always look very native to the platform). 例如,在Windows上使用.NET,对于Linux甚至是基于Java的应用程序,请使用mono。(尽管它们看起来并不总是平台特有的)。 Then use your library from there. 然后从那里使用您的图书馆。

Ultimate++ might contain what you need. Ultimate ++可能包含您需要的内容。 (Although they make it sound in the FAQ as if their library is really big, it doesn't seem that bad to me.) (尽管他们在FAQ中听起来像他们的图书馆真的很大,但对我来说似乎并不那么糟糕。)

别忘了检查一下果汁

Qt works amazingly, but is not very small. Qt的工作原理惊人,但不是很小。 I've found there is a genuine lack of "small" cross-platform GUIs. 我发现确实缺少“小型”跨平台GUI。 You either might try to just abstract your GUI with #ifdefs all over the place, or use Qt/wx. 您可以尝试在各处使用#ifdefs抽象您的GUI,或者使用Qt / wx。

If you want it to be small, just write the GUI twice -- once in MFC and then in X. Your GUI sounds simple enough. 如果您希望它很小,则只需编写两次GUI,一次在MFC中,然后在X中。您的GUI听起来很简单。 Build up your own small abstraction that is just what you need. 建立您自己所需的小型抽象。

Like others mentioned you cannot mix the "cross platform" and small in size in the same sentence. 像其他提到的一样,您不能在同一句子中混合使用“跨平台”和小字体。

More work, smaller in size: One solution I can suggest is to use native python binding for the UI portion. 更多工作,更小尺寸:我可以建议的一种解决方案是对UI部分使用本机python绑定。 Since you are already using boost, it should be fairly trivial to have Boost.Python communicate between C++ space and python space. 由于您已经在使用boost,因此让Boost.Python在C ++空间和python空间之间通信应该是微不足道的。 You already have python on Linux and its a 20-40MB package on Windows (can't remember how big the latest release is). 您已经在Linux上安装了python,在Windows上安装了20-40MB的软件包(不记得最新版本的大小)。 But here you will have to use win32 binding on windows and gtk/qt bindings on linux, so more work. 但是在这里,您将必须在Windows上使用win32绑定,在Linux上使用gtk / qt绑定,因此需要做更多的工作。 Nah, too much work to maintain, scratch this. 不,要维护的工作太多了,请抓紧时间。

Moderate work, smaller in size but with non-native controls: You can try to get clutter or freeglut to get your UI work done but I personally haven't used them so I don't know if they provide full native looks for your apps. 中等工作量,体积较小,但具有非本地控件:您可以尝试使混乱或freeglut来完成UI工作,但我个人没有使用过它们,因此我不知道它们是否为您的应用程序提供完整的本机外观。 But they are small in size compared to wx or qt. 但是与wx或qt相比,它们的尺寸较小。

Less work, bigger in size: Use WxWidgets if you are already comfortable with it, otherwise I recommend Qt. 更少的工作,更大的尺寸:如果已经习惯使用WxWidgets,否则建议使用Qt。

You can also have a look at some of the other offerings: http://en.wikipedia.org/wiki/List_of_widget_toolkits 您还可以查看其他一些产品: http : //en.wikipedia.org/wiki/List_of_widget_toolkits

Clutter: http://www.clutter-project.org/about FreeGLUT: http://freeglut.sourceforge.net 杂波: http: //www.clutter-project.org/关于FreeGLUT: http ://freeglut.sourceforge.net

这里有大量的活跃和不活跃的跨平台C ++ UI库: https : //philippegroarke.com/posts/2018/c++_ui_solutions/其中一些很小,看起来很自然。

ever heard of QT ??? 听说过QT吗???

http://qt.nokia.com/products/ http://qt.nokia.com/products/

i think it should fits all your your needs 我认为它应该适合您的所有需求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM