WPF / C#和Qt / C之间进行选择++ [英] Choosing between WPF/C# and Qt/C++

查看:5835
本文介绍了WPF / C#和Qt / C之间进行选择++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的团队正在开发一个应用程序,它涉及到一个后端用C ++编写,并涉及利用图书馆,如OpenCV的,MIL等。



现在我们需要制定一个GUI有了这个程序接口,使得GUI显示的图像,用户可以与图像交互和注释/标记的图像,然后运行C ++编写的显示效果图像处理算法。



有关的图形用户界面,我是WPF和Qt
之间卡住选择我个人觉得WPF是更容易,并且比Qt的
我明白了更强大这WPF是不可移植到Linux,但我并不担心太多...
此外,WPF使用DirectX技术,我可能会用它来产生在后一阶段的一些三维可视化。



请帮我看看以下几点:




  1. 我可以对接WPF直接与C ++(而不是使用Visual C#??)

  2. 如果(1点)是不可能的,那么考虑一下:
    在C ++中的代码将是很大的,以及涉及一些图书馆也一样,所以我可以使用C#调用C ++函数
    。将投资于学习的Qt的时候是不是让我的非托管非面向对象的C ++代码的工作与WPF?



  3. (我有我不得不写太多的代码,用于连接C ++与WPF,这可能等于实际的程序本身的改写半下沉的感觉... :-( )


    解决方案

    我用两个Qt的使用C ++和WPF。我更喜欢WPF作为用户界面框架。 Qt是不差,尤其是发布4.0。我甚至不会碰Qt的早期版本。



    正如其他人的评论中已经说过,WPF是更好地记录和在线社​​区较大。如果你正在寻找风格的应用程序WPF肯定是要走的路。 Qt的声明语言,新鲜的是沿着这条道路一个很好的一步,但因为它是如此新的它往往是一个有点马车。 WPF一直围绕更长,更成熟,在功能丰富。



    不过,我认为你的情况,真正的问题是,你的C ++代码库。



    WPF要求,以便与您的C ++代码库正确接口的C ++ / CLI层(托管C ++)。这听起来很复杂,确实需要工作的一点点,但它并不像疯了,因为它听起来。并有吨对本文档的为好。我个人从PInvoke的远离。



    Qt是更容易一些,因为它是基于C ++的,但你将有一些翻译的C ++原生类型,和Qt类型之间做(喜欢的QString,的QList等...),它们在内部使用。



    另一个要考虑的事情是什么样子和感觉,你想为你的UI。例如,如果你想一个不错的功能区(办公室2008年,2010年)看,那么你不会使用Qt得到这个。此外,有一吨的第三方WPF控件,但我还没有发现Qt的非常多。在某些情况下,这是非常方便的买到一套很好的控制,以补充那些微软给出了默认。



    在过去的几年中,我们没有要求有我们一直使用WPF一个Linux用户界面,无论代码库。我们没有后悔呢。



    不过,我也建议第三个选项。代码乔克是一个UI框架,它是基于MFC,我相信。这是C ++和基于ActiveX的。它已经变得相当复杂。看吧 href=\"http://www.codejock.com/\">



    编辑:
    QML已经到来很长的路要走,因为我第一次看它。我还没有时间去看看它在深度,但是从我听到它提供了一些非常有趣的功能。这是值得额外的样子。



    另外,一些评论表明,有更多类似Office的控制,如缎带,以及一些图表和图形控制已经加入到了Qt工具集。这些都使得Qt一个有趣的前景。



    我会的东西站在我前面说的虽然,作为一个程序员,我觉得做用户界面与WPF轻松许多,我我更高兴,我的结果比我曾经使用Qt编码的东西。


    Me and my team are developing an application, which involves a back-end written in C++ and involves use of libraries such as OpenCV, MIL, etc.

    Now, we need to develop a GUI to interface with this program, such that the GUI displays the images, and the user can interact with the images and annotate / mark the images, and then run the image processing algorithms written in C++ to display results.

    For the GUI, i am stuck choosing between WPF and Qt I personally find WPF to be easier, and more powerful than Qt I understand that WPF is not portable to Linux, but i am not worried about this too much... Also, WPF uses the DirectX technology, which i may have to use to generate some 3-D visualization at a later stage.

    Please help me with these points :

    1. Can I interface WPF directly with C++ (and not with Visual C# ??)
    2. If (Point 1) is not possible, then consider this : The code in C++ is going to be big, and involving some libraries too, so can i use C# to call C++ functions Would the time invested in learning Qt be lesser than making my unmanaged non-OO C++ code work with WPF ?

    (i have a sinking feeling that I'd have to write too much code for interfacing C++ with WPF, which may equal rewriting half of the actual program itself... :-( )

    解决方案

    I've used both Qt with C++ and WPF. I much prefer WPF as a User Interface framework. Qt isn't bad, especially post 4.0. I wouldn't even touch earlier versions of Qt.

    As others have said in comments, WPF is better documented, and the online community is larger. If you are looking at styled applications WPF is certainly the way to go. Qt's Declarative language which is new is a good step along that road, but because it's so new it tends to be a bit buggy. WPF has been around longer, and is more mature and richer in features.

    However, I think the real issue in your case is the c++ code base that you have.

    WPF will require a C++/CLI layer (managed C++) in order to interface properly with your c++ code base. This sounds complicated, and does require a little bit of work, but it is not as crazy as it might sound. And there is tons of documentation about this as well. Personally I would stay away from PInvoke.

    Qt is a little easier because it is c++ based, but you will have some translation to do between c++ native types, and Qt types (like QString, QList etc...) that are used internally.

    Another thing to consider is what look-and feel you would like for your UI. For example if you were thinking about a nice Ribbon (office 2008, 2010) look, then you will not get this with Qt. Also, there are a ton of third-party WPF controls, but I haven't found very many for Qt. In some cases it is very handy to buy a nice set of controls to supplement the ones Microsoft gives by default.

    Over the past couple of years where we don't have a requirement to have a linux UI we have been using WPF, regardless of the code base. We haven't regretted it yet.

    However, I will also suggest a third option. Code-jock is a UI framework that is based on MFC I believe. It is c++ and ActiveX based. It has become quite sophisticated. Check it out here.

    EDIT: QML has come a long way since I first looked at it. I haven't had the time to look at it in depth, but from what I hear it offers some very interesting features. It is worth an extra look.

    Also, as a few comments have indicated, there are more Office-like controls such as a ribbon, and also some diagram and graphing controls that have added to the Qt toolset. These do make Qt an interesting prospect.

    I will stand by something I said earlier though, that as a programmer I find making UIs with WPF a whole lot easier, and I am more pleased with my results than anything that I have ever coded with Qt.

    这篇关于WPF / C#和Qt / C之间进行选择++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆