简体   繁体   English

什么是具有最简单学习曲线的C ++ GUI构建选项 - VS / Qt / wxWidgets /等?

[英]What's the C++ GUI building option with the easiest learning curve - VS/Qt/wxWidgets/etc.?

I'm looking to be able to build GUI applications quickly and painlessly as possible. 我希望能够尽可能快速,轻松地构建GUI应用程序。 I'm competent (though not expert, and have no formal training) in C++, but have never used a GUI building toolkit or framework or anything. 我在C ++中胜任(虽然不是专家,也没有正式的培训),但从未使用过GUI构建工具包或框架或任何东西。 I am not a professional programmer and am totally inexperienced and ignorant when it comes to building GUI apps. 我不是一名专业程序员,在构建GUI应用程序时,我完全缺乏经验和无知。 Have spent hours researching trying to figure out what to do; 花了几个小时研究试图弄清楚要做什么; only getting more confused and discouraged though. 但是,只会变得更加困惑和沮丧。

Qt and wxWidgets seem like the most popular options for cross-platform apps, though cross-platform isn't necessarily all that important to me; Qt和wxWidgets似乎是跨平台应用程序最受欢迎的选项,尽管跨平台对我来说不一定非常重要; Windows-only is fine if that means the fastest learning curve. 如果这意味着最快的学习曲线,那么Windows就可以了。

Qt seems cool and the Qt Creator is sweet looking with lots of good demos, except it has its own classes for everything, and I'm not overly keen on learning a bunch of stuff that's only applicable to the Qt platform itself rather than more generally. Qt看起来很酷,Qt Creator看起来很漂亮,有很多很好的演示,除了它有自己的所有类,我不是太热衷于学习一堆只适用于Qt平台本身而不是更普遍的东西。 I suppose I could avoid using the Qt classes except for the GUI stuff where I have to use them, but I have no idea how wise or unwise that would be. 我想我可以避免使用Qt类,除了我必须使用它们的GUI内容,但我不知道那将是多么明智或不明智。

I was thinking Visual Studio would have the smallest learning curve, but when I open a test GUI app, I see a bunch of foreign looking stuff like carats (^) all over the place - I found online that these mean "handles", which I have trouble even understanding the definition or purpose of ("sort of like pointers but not really" is basically how I've read people define them). 我认为Visual Studio会有最小的学习曲线,但是当我打开一个测试GUI应用程序时,我看到一堆外国人看起来像克拉(^)的东西 - 我在网上发现这些意思是“句柄”,我甚至无法理解定义或目的(“有点像指针但不是真的”基本上是我读过人们如何定义它们)。

I know pretty much nothing about wxWidgets, or how it compares with Qt. 我对wxWidgets几乎一无所知,或者它与Qt的比较。

So every option has a big learning curve - and ideally I'd like to know which one minimizes the time you have to spend learning the toolkit/framework itself. 因此,每个选项都有一个很大的学习曲线 - 理想情况下,我想知道哪个选项最大限度地减少了学习工具包/框架本身的时间。 Since I'm likely never going to be making money from the programs I create, the time I spend learning a specific toolkit would be pretty costly. 由于我可能永远不会从我创建的程序中赚钱,所以我花在学习特定工具包上的时间非常昂贵。 I just want to be able to make a functional program using the C++ knowledge I have, but in GUI form. 我只是希望能够使用我拥有的C ++知识制作一个功能程序,但是以GUI形式。 At the moment it seems if I want to make a GUI app, I'd have to spend way more time learning the GUI framework I'd use than writing the functional part of the app itself. 目前似乎我想制作一个GUI应用程序,我不得不花费更多的时间来学习我使用的GUI框架,而不是编写应用程序本身的功能部分。

Any input from people wiser and more experienced than me would be appreciated :) 任何来自人更聪明,更有经验的投入都会受到赞赏:)

Which is the easiest to learn is really going to depend on how you personally learn. 哪个是最容易学习的,实际上取决于你个人的学习方式。

Personally , I've found Qt to be the easiest to learn so far. 就个人而言 ,到目前为止,我发现Qt是最容易学习的。 The GUI classes are rather nice to use, but I've found the non-GUI classes to be excellent, making it easy to avoid a lot of common issues you'd normally get with a more basic API. GUI类很好用,但我发现非GUI类非常好,可以很容易地避免使用更基本的API通常会遇到的许多常见问题。 The documentation is excellent, IMO, as are the books, the examples, etc. It's also being very actively developed, with a few new technologies coming in the near future (like DeclarativeUI). 文档非常好,IMO,书籍,示例等等。它也在非常积极地开发,在不久的将来会有一些新技术(如DeclarativeUI)。

I've found Visual Studio/Windows API/.Net to be a good bit more complicated to learn. 我发现Visual Studio / Windows API / .Net要学习起来有点复杂。 The API documentation on MSDN is rather complicated and not really organized in a manner that I find intuitive. MSDN上的API文档相当复杂,并没有以我直观的方式进行组织。

I've tried learning WxWidgets a few times, but I've never liked the API documentation. 我曾尝试过几次学习WxWidgets,但我从未喜欢过API文档。

All this is just my personal experience, YMMV of course. 这一切只是我的个人经历,YMMV当然。 I'd say just dabble in all of them and see which one takes you the furthest, it won't hurt to try multiple. 我会说只是涉足所有这些,看看哪一个带你走得最远,尝试多个也不会受到伤害。

First and foremost, start simple. 首先,开始简单。 There's a lot to the subject. 这个主题有很多。 If you are finding it hard, don't try and take it in all at once. 如果您发现它很难,请不要尝试一次性使用它。

Most of the good GUI packages have tutorials. 大多数优秀的GUI包都有教程。 The best advice I can give is that you try each of them, or at least a couple of them. 我能给出的最好建议是你尝试每一个,或至少其中几个。 They are the best short introduction you can have to the library you choose and if they are any good they narrow down what you need to absorb at first. 它们是您选择的图书馆最好的简短介绍,如果它们有任何好处,它们会缩小您最初需要吸收的内容。 That will give you some basis for comparison, because they are each trying to do very similar things (and you will see some of them before you are done), but they have different feels. 这将给你一些比较的基础,因为他们每个人都试图做非常相似的事情(你会在完成之前看到其中的一些),但他们有不同的感觉。 You will likely find you have a preference for one and that's the one to get serious with. 你可能会发现你偏爱一个,而那个是认真的。 It will also give you a sense of what's hard about GUI programming as separate from the particulars of one package, which, if you have only used one, you won't have seen. 它还将让您了解GUI编程的难点, 一个软件包的细节分开 ,如果您只使用了一个软件包,那么您将不会看到它。 Personally I find this sort of knowledge very helpful, because it makes me less intimidated by particulars. 就个人而言,我觉得这种知识非常有用,因为它让我对细节不那么害怕。

Here's a list of tutorials in one place, though you have likely seen them already: 以下是一个地方的教程列表,尽管您可能已经看过它们:

Second, it sounds to me that you need to get some in depth understanding of the concepts of GUI programming, not just a particular library. 其次,听起来你需要深入了解GUI编程的概念 ,而不仅仅是特定的库。 Here there is no substitute for a book. 这里没有替代书。 I don't know all of them by a long shot, but the best of the bunch will not just teach you the details of a toolkit, they will teach you general concepts and how to use them. 我不是很了解所有这些,但是最好的不仅仅是教你工具包的细节,他们会教你一般概念以及如何使用它们。 Here are some lists to start with though (and once you have titles, Amazon and Stack Overflow will help to pick one): 以下是一些开始的列表(一旦你有标题,亚马逊和Stack Overflow将有助于选择一个):

Third, take advantage of the design tools (Qt Creator, VS's form building and so on). 第三,利用设计工具(Qt Creator,VS的表单构建等)。 Don't start by trying to read through all the code they generate: get your own small programs running first. 不要首先尝试阅读它们生成的所有代码:首先运行自己的小程序。 Otherwise it's too hard to know what matters for a basic program and what doesn't. 否则,很难知道什么对基本程序有用,什么不对。 The details get lost. 细节迷失了。 Once you've got the basics down though, Do use them as references to learn how to do specific effects. 一旦你掌握了一些基本下来,虽然, 不要用它们作为参考来学习如何做具体的效果。 If you can get something to work in the design tools, then you can look at particular code they generate to be able to try on your own hand-written programs. 如果你可以在设计工具中使用某些东西,那么你可以查看他们生成的特定代码,以便能够尝试自己的手写程序。 They are very useful for intermediate learning. 它们对于中级学习非常有用。

I'm not overly keen on learning a bunch of stuff that's only applicable to the Qt platform itself rather than more generally. 我并不过分热衷于学习一堆只适用于Qt平台本身而不是更普遍的东西。

I second the comment of GRB here: Don't worry about this. 我在这里继续GRB的评论 :不要担心这个。 You are going to need to learn a lot specific to the toolkit no matter which toolkit you use. 无论您使用哪种工具包,您都需要学习很多特定于工具包的知识。 But you will also learn a lot that's general to GUI programming with any of the decent toolkits, because they are going to have to cover a lot of the same ground. 但是,你也会学到很多东西这是一般的 GUI来与任何像样的工具包的编程,因为他们将不得不支付大量的同地面。 Layouts, events, interaction between widgets/controls, understanding timers -- these will come up in any GUI toolkit you use. 布局,事件,小部件/控件之间的交互,理解计时器 - 这些将出现在您使用的任何GUI工具包中。

However do be aware that any serious GUI package is an investment of time. 但请注意,任何严肃的GUI包都是时间的投入。 You will have a much easier time learning a second package if you decide to pick one up, but every large library has its personality and much of your time will be spent learning its quirks. 如果您决定选择一个包,那么学习第二个包将会更容易,但是每个大型图书馆都有自己的个性,并且您将花费大量时间来学习它的怪癖。 That is, I think, a given in dealing with any complex subject. 也就是说,我认为,在处理任何复杂的主题时都是如此。

I suppose I could avoid using the Qt classes except for the GUI stuff where I have to use them, but I have no idea how wise or unwise that would be. 我想我可以避免使用Qt类,除了我必须使用它们的GUI内容,但我不知道那将是多么明智或不明智。

You do not need most of the non-GUI classes of Qt to use Qt's GUI properly. 您不需要大多数Qt的非GUI类来正确使用Qt的GUI。 There are a handful of exceptions (like QVariant ) which you'll need just because the GUI classes use them. 有一些例外(如QVariant ),你需要它们只是因为GUI类使用它们。 I found you can learn those on a case-by-case basis. 我发现你可以根据具体情况学习。

As a person who learned C++ through Qt, I can only say that they work very well together. 作为一个通过Qt学习C ++的人,我只能说他们在一起工作得非常好。 C++ purists (like I have become) will find lots of things in Qt not to their liking (the moc preprocessor, eg, and the continued absence of exceptions for error reporting), but looking back, Qt provided a very gentle introduction to C++ for me. C ++纯粹主义者(就像我已经成为)会在Qt中找到许多不符合他们喜欢的东西(例如, moc预处理器,以及错误报告的异常持续缺失),但回顾过去,Qt提供了一个非常温和的C ++介绍我。

And if you're like me, you throw in a handful of boost libs in each Qt project, because we want to write "real" C++, not the softened thing Qt uses :) 如果你像我一样,你会在每个Qt项目中输入一些提升库,因为我们想要编写“真正的”C ++,而不是Qt使用的软化的东西:)

I would suggest wxWidgets. 我会建议使用wxWidgets。 To me, it's pretty intuitive and looks nice. 对我来说,它非常直观,看起来不错。

Code::Blocks was built with it, so check that out to see if you like the graphics. Code :: Blocks是用它构建的,所以检查一下是否喜欢图形。

There are also a slew of bindings for wxWidgets, such as wxPython, wxErlang, and others, so if you decide to switch off of C++, you can take wxWidgets with you. wxWidgets还有很多绑定,例如wxPython,wxErlang等,所以如果你决定关闭C ++,你可以随身携带wxWidgets。

I also use wxWidgets and use it all the time for Windows-only applications (the only downside is that wxWidgets is notorious for large .exe filesizes, which may or may not be a problem for you). 我也使用wxWidgets并且一直用于仅限Windows的应用程序(唯一的缺点是wxWidgets因大型.exe文件大小而臭名昭着,这对你来说可能是也可能不是问题)。 I found it very simple to use from the start, especially when combined with a GUI designer (personally I use wxDev-C++). 我发现从一开始就使用它非常简单,特别是当与GUI设计器结合使用时(我个人使用wxDev-C ++)。

I've never used Qt, so I can't speak to its simplicity, but I doubt the difficulty is on a vastly different scale than that of wxWidgets. 我从来没有使用过Qt,所以我不能说它简单,但我怀疑难度与wxWidgets的难度大不相同。 However, what I can say is that no matter what API you use (wxWidgets, Qt, WinAPI, etc) your code will be "locked into" that particular platform, so don't worry if you feel that learning Qt will lock you into the Qt platform (because the same thing will happen with any of those APIs). 但是,我可以说的是,无论你使用什么API(wxWidgets,Qt,WinAPI等),你的代码都会“锁定”到那个特定平台,所以如果你觉得学习Qt会锁定你Qt平台(因为任何这些API都会发生同样的事情)。

If you're working solely on Windows however, you may want to do a few simple programs with WinAPI first. 但是,如果你只是在Windows上工作,你可能想先用WinAPI做一些简单的程序。 That way you have a basic understanding of the lowest level of Windows GUI programming before you move onto Qt/wxWidgets. 这样,在进入Qt / wxWidgets之前,您已经基本了解了最低级别的Windows GUI编程。 That said, if you're really into cross-platform programming, then don't worry about that and go straight into Qt/wxWidgets. 也就是说,如果你真的进入跨平台编程,那么不要担心,直接进入Qt / wxWidgets。

I can't intelligently comment on the learning curve aspect, but a quick survey of StackOverflow questions shows about twice as many Visual C++ questions as Qt questions. 我无法智能地评论学习曲线方面,但对StackOverflow问题的快速调查显示,与Qt问题相比,Visual C ++问题的数量是其两倍。 Probably means that there is a larger support group in place for Visual C++. 可能意味着Visual C ++有一个更大的支持组。 Might make learning it a little easier if there are more folks to help out. 如果有更多的人帮忙,可能会让学习变得容易一些。

No matter what you pick, I am quite sure it won't be easy and painless. 无论你选择什么,我都相信它不会轻松无痛。

Having said that, I know that in some schools they use FLTK because they consider it relativelly easy to learn. 话虽如此,我知道在一些学校他们使用FLTK因为他们认为它相对容易学习。 I have never tried it. 我从来没有尝试过。

In my everyday work I use WTL which is as close to the system as it gets while still providing some level of abstraction over pure Win32. 在我的日常工作中,我使用WTL,它与系统一样接近,同时仍然提供纯粹的Win32的某种程度的抽象。 I am not sure if I would consider it easy to learn, though, especially given the lack of documentation. 我不确定我是否会认为这很容易学习,特别是考虑到缺乏文档。

I recommend codegear C++ builder (previously known as borland C++ builder) from codegear which comes with a 30 trial. 我建议从CodeGear的C ++助洗剂(以前称为Borland的C ++助洗剂) CodeGear的 ,它有一个30试用。 The nicest thing about it is that the GUI provides you with components that you drop onto a form in a WYSIWYG fashion and make functional by adding code to handle the events it fires. 最好的事情是GUI为您提供了以WYSIWYG方式放在表单上的组件,并通过添加代码来处理它触发的事件。 It comes with a whole bunch of compontents out of the box and you can add 3rd party components to it too, like the awesome ExpressQuantumGrid from devexpress , or write your own. 它带有一大堆开箱即用的组件,您也可以添加第三方组件,如来自devexpress的超级 ExpressQuantumGrid,或者自己编写。 It's very powerfull if you know what you're doing but intuitive enough that a beginner can write a database CRUD application in about 20 lines of very simple code. 如果您知道自己在做什么但又非常直观,初学者可以在大约20行非常简单的代码中编写数据库CRUD应用程序,这是非常强大的。

Since nobody has mentioned it yet, for the sake of completeness, have a plug for the Fox toolkit . 由于没有人提到它,为了完整起见,有一个Fox工具包的插件。 This is the one I used last time I did any C++ UI work of my own volition. 这是我上次使用自己的意志做任何C ++ UI工作的那个。 There are also binding for this to Ruby and Python (the latter being many years out of date, though). 对Ruby和Python也有绑定(后者虽然过时了许多年)。

In general, the choice of a toolkit for self-directed work comes down to personal preferences for 一般而言,为自主工作选择工具包可归结为个人偏好

  1. the layout manager style 布局管理器样式
  2. the event handler registration style 事件处理程序注册样式
  3. How native the widget set looks/can be made to look 窗口小部件集看起来/可以看起来如何原生

Qt is the best option for you. Qt是您的最佳选择。 It's the easiest to learn, the most elegant and powerful and it is completely free. 这是最容易学习,最优雅和最强大的,它是完全免费的。

  • Visual C++: This is an IDE, but it comes with its own GUI library called MFC. Visual C ++:这是一个IDE,但它带有自己的GUI库,名为MFC。 MFC is an old library with many quirks and it is difficult to learn and use. MFC是一个有许多怪癖的旧图书馆,很难学习和使用。 Many C++ programmers use it on Windows because it comes from MS, it's fast and it's free if you buy Visual C++. 许多C ++程序员在Windows上使用它,因为它来自MS,它很快,如果你购买Visual C ++它是免费的。 Since VC++ is an IDE, you can also use wxWidgets and Qt with it, although in your particular case I would recommend Qt Creator instead. 由于VC ++是一个IDE,你也可以使用wxWidgets和Qt,虽然在你的特殊情况下我会推荐使用Qt Creator。

You seem to have experimented with Managed C++. 您似乎已经尝试过托管C ++。 Don't use that, even MS recommends that you only use Managed C++ as glue between C++ and C#. 不要使用它,即使MS建议你只使用托管C ++作为C ++和C#之间的粘合剂。

  • wxWidgets: This one was a strong contender up to the day when Qt became free for commercial projects. wxWidgets:在Qt获得商业项目免费的那一天,这是一个强有力的竞争者。 It was always in the shadow of Qt and it is known that the documentation is not very good and the API is not as easy to learn as Qt's. 它始终处于Qt的阴影之下,众所周知,文档不是很好,而且API不像Qt那样容易学习。 Cross-platform MFC would be a good way to describe it. 跨平台MFC将是描述它的好方法。

  • C++ Builder: Borland made too many mistakes with C++ Builder and ended up getting out of the dev tools business altogether. C ++ Builder:Borland在C ++ Builder中犯了太多错误,最终完全脱离了开发工具业务。 It was a good product and I originally learned Windows GUI programming in one of the first versions, but I won't use it any more. 这是一个很好的产品,我最初在其中一个版本中学习了Windows GUI编程,但我不会再使用它了。 There are better options and it is too expensive. 有更好的选择,它太贵了。

If cross-platforming is not necessary, try .net + msvs or delphi . 如果不需要跨平台,请尝试.net + msvsdelphi easy, all-in-one, no pain. 容易,一体化,没有痛苦。

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

相关问题 使用Java本机代码或C ++(QT,WxWidgets等)进行平台无关的编程 - Platform-independent programmming with Java native code or C++ (QT, WxWidgets etc.) 带有wxWidgets,Unicode与ASCII的C ++,有什么区别? - C++ with wxWidgets, Unicode vs. ASCII, what's the difference? C ++中用于GUI的WXwidgets: - WXwidgets for GUI in C++: 通用学习资料中的wxWidgets和GUI新手? (wxWidgets 3.0,C ++,Win 7,CodeBlocks) - New to wxWidgets and GUI in general - learning materials ? ( wxWidgets 3.0, C++, Win 7, CodeBlocks ) C ++中'和','或'等关键字的目的是什么? - What is the purpose of the 'and', 'or', etc. keywords in C++? 使用包含%1,%2等的格式字符串,而不是%d,%s等。 - Linux,C ++ - Use format strings that contain %1, %2 etc. instead of %d, %s etc. - Linux, C++ 什么样的C ++语句是wxWidgets事件表? - What kind of C++ statement(s) is the wxWidgets event table? 在单独的GUI类(菜单,工具栏等)之间共享操作的最佳方法是什么? - What's the best way to share actions between separate GUI classes (menu, toolbars, etc.) 使用Python和tkinter与Qt和C ++进行GUI开发 - GUI developement using Python and tkinter vs Qt and C++ 'for'循环vs Qt的'foreach'在C ++中 - 'for' loop vs Qt's 'foreach' in C++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM