C++ 的优点和缺点是什么? Qt 与 Eclipse RCP 进行跨平台 GUI 开发?

发布于 2024-10-30 19:46:42 字数 121 浏览 0 评论 0 原文

我将为现有的 C++ 应用程序开发一个新的 GUI。该应用程序可在 Windows 和 Linux 上运行,与 GUI 的通信是通过客户端/服务器进行的。

Eclipse RCP 和 Qt 之间的优缺点是什么?

I am going to develop a new GUI for an existing C++ application. The application works on Windows and Linux, and the communication with GUI is through client/server.

What are the pros and cons between Eclipse RCP and Qt?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酷遇一生 2024-11-06 19:46:42

Qt 的一些优点:

  • C++ 的东西通常会表现得更好;然而,这是有争议的。
  • Qt 是 Meego 的基础,Meego 是由 Intel、AMD 等公司赞助的移动平台;然而,它目前的势头对我来说似乎不太高。这意味着您还可以为各种移动设备和一般嵌入式设备创建应用程序
  • 。有很多基于 Qt 的应用程序。
  • 它有一个所见即所得设计器
  • 适合小型到大型项目,特别是因为 QtQuick,它允许立即创建小型应用程序,并且对 C++ 的了解几乎为零。
  • Qt 在 Python 中有一个令人惊叹的包装器,称为 PyQt(当然还有 PySide),它允许快速创建小型应用程序。开发和光滑的原型设计。因此,人们经常将 PyQt(或 PySide)用于 Qt 应用程序的 UI 端。当然,您可以在同一个应用程序中轻松组合 Python 和 Qt,利用它们的所有优点(但也有缺点)。即使对于大型项目,这也允许相对快速和平稳的开发周期

Qt 的一些缺点:

  • 基于 Qt 的应用程序的代码使用一些不属于 C++ 的元素,这些元素必须转换为 C++在实际执行之前,由名为 moc(元对象编译器)的特殊预处理器汇编。您和您的构建系统必须考虑到这一点。
  • 诺基亚(Qt 的前所有者,因为它收购了 Trollech)有 将其卖给 Digia。然而,这并不意味着他们参与开源Qt的开发已经发生了变化。

Eclipse RCP 的一些优点:

  • Eclipse RCP 远不止是一个图形工具包:

    • 它采用基于插件的架构,有助于在不同组件(插件)之间分配功能并保持对这些组件(插件)之间依赖关系的控制。 Eclipse 插件系统依赖于自己的 Java 组件系统规范实现,称为 OSGi
    • 它提供了一种机制来实现解耦应用程序可扩展性,称为扩展点.

  • 您可以在应用程序中使用许多 Eclipse 插件,其中许多插件都具有以下发行许可证:对商业产品友好。

  • 它有一个所见即所得设计器

Eclipse RCP 的一些缺点:

  • Eclipse 使用名为 SWT 的自定义窗口工具包;在每个平台上,它都依赖于本机图形层。在 Linux 上,它依赖于 Gtk+ (尽管也可以使用 Motif),根据我的经验(< a href="http://vektor.ca/eclipse/gtk-performance-notes.html" rel="nofollow noreferrer">和其他的)存在性能问题,主要是与高速更新的小部件有关。实际上,我们中的许多人在 Eclipse RCP 应用程序中嵌入 Swing 元素来克服性能问题,同时保持 Eclipse 的可扩展架构;然而,这可能会带来 集成问题。有一个使用 Qt 作为后端的 SWT 版本,但它并入 Eclipse 的代码库似乎自 2010 年 10 月以来一直停滞不前

  • Eclipse RCP 应用程序的启动时间(理解为从应用程序启动到显示窗口所经过的时间)可能会很长。

    启动时间

  • 如果您打算通过 JNI 将 C++ 内容与 Java 集成,请注意有些人觉得很难

  • Eclipse 有很多很多错误。 Eclipse 的 bugzilla 对于 RCP 开发人员来说是非常有用的资源。

  • 您越希望 Eclipse RCP 应用程序的外观和行为与 Eclipse IDE 不同,您遇到的麻烦就越多。

  • 在我看来,Eclipse RCP 开发有一个很大的学习曲线。

  • 对于小型项目使用 Eclipse RCP 基本上是自杀(除非您限制自己只创建插件或类似的东西)。由于其基础设施、资源需求和上述陡峭的学习曲线的复杂性,它适用于中型到大型和超大型项目。

  • Eclipse RCP 不适用于移动开发,因为...它是 RCP(富客户端平台)。如果您想使用移动设备,那么这不适合您。

在我看来,它们的发行许可证(Qt 的 LGPL/GPL/商业版、Eclipse 的 EPL)对于大多数用途来说都足够灵活。不过,我不是律师,所以我可能会弄错。

当然,还应该考虑其他因素,例如开发人员的经验、技术技能、团队规模、具体要求等。

顺便说一句,我在 Eclipse RCP 方面有很多经验,但只有 Qt 的理论知识,所以我的陈述可能有偏见/错误。

Some pros of Qt:

  • C++ stuff will generally perform better; however, this is arguable.
  • Qt is the base of Meego, the mobile platform sponsored by Intel, AMD and others; however, its current momentum seems not too high to me. This means you can also create applications for various mobile and generally embedded devices
  • There are a lot of Qt-based applications out there.
  • It has a WYSIWYG designer.
  • Good for small to large projects especially because of QtQuick, which allows the creation of small applications in no time and with almost zero knowledge about C++
  • Qt has an amazing wrapper in Python called PyQt (there is also the PySide of course), which allows rapid development and slick prototyping. People often use PyQt (or PySide) for the UI-side of a Qt application because of that. You can of course combine with ease Python and Qt in the same application taking advantage of all their strengths (but also weaknesses). This allows relatively fast and smooth development cycles even for large projects

Some cons of Qt:

Some pros of Eclipse RCP:

  • Eclipse RCP is far more than a graphical toolkit:

    • It sports a plugin-based architecture that can help distributing functionality among different components (plugins) and keeping control over dependencies among such components (plugins). Eclipse plugin system relies on their own implementation of the Java component system specification called OSGi.
    • It provides a mechanism to enable decoupled application extensibility called extension points.
  • There are many Eclipse plugins that you can use in your application and many of them have distribution licenses that are friendly to commercial products.

  • It has a WYSIWYG designer.

Some cons of Eclipse RCP:

  • Eclipse uses a custom windowing toolkit called SWT; on each platform it relies on the native graphical layer. On Linux, it relies on Gtk+ (although it's also possible to use Motif), which in my experience (and other's) has performance problems, mostly with widgets that are updated at high rates. Actually many of us embed Swing elements in Eclipse RCP applications to overcome performance problems while keeping Eclipse's extensible architecture; this, however, can bring integration problems. There's a version of SWT that uses Qt as backend, but its incorporation into Eclipse's codebase seems stagnated since October 2010.

  • Startup time (understood as the time elapsed since the application is launched until it shows up a window) of Eclipse RCP applications can be very long.

  • If you intend to integrate C++ stuff with Java by means of JNI, be aware that some people find it difficult.

  • Eclipse has lots and lots of bugs. Eclipse's bugzilla is a very useful resource for the RCP developer.

  • The more you want you Eclipse RCP application's look&feel and behaviour to differ from Eclipse IDE, the more troubles you will get into.

  • Eclipse RCP development has a big learning curve, in my opinion.

  • Using Eclipse RCP for small projects is basically a suicide (unless you are restricting yourself to only creating a plugin or similar). It is meant for medium to large and very large projects due to the complexity of its infrastructure, resource requirements and the above mentioned steep learning curve.

  • Eclipse RCP is not for mobile development because...it's RCP (Rich Client Platform). If you want to go mobile, this is not for you.

Both their distribution licenses (LGPL/GPL/commercial for Qt, EPL for Eclipse) are flexible enough for most uses, in my opinion. Nevertheless, I am not a lawyer, so I may be mistaken about that.

And of course, other factors like the experience of the developers, their technical skills, the size of the team, concrete requirements, etc, should be taken into account.

BTW, I have much experience in Eclipse RCP but only theoretical knowledge on Qt, so I may be biased/mistaken in my statements.

无风消散 2024-11-06 19:46:42

现在 Qt 拥有 LGPL 许可证,我会在一周中的任何一天选择 Qt 而不是 Eclipse RCP。

我已经使用两者来创建相当复杂的应用程序。

由于您可以使用 eclipse 来开发 c++,我假设我们主要比较的是 swt/jface 与 Qt,而不是 eclipse 开发环境本身。

我注意到两者都使用过的一些事情:

1) Qt 有更好的文档和示例

除了网络上的一些半生不熟的示例之外,我几乎找不到有用的 eclipse 文档。

2) Qt 拥有更多的“专业”用户

有许多专业公司使用 Qt 作为他们的 UI 框架。鉴于它支持三个平台(Windows、Linux、Mac),它非常灵活,并且有很多支持。

3) Qt 趋于更加完整和成熟 -

使用 Eclipse,我注意到很多时候可用的控件和包只是部分完成,而不是完全完整。它们通常是为某人的使用而开发的,并且仅进行编码。 Qt 的控件几乎总是完整的设计。

4) 样式。

Qt 和 Eclipse 都使用本地平台库进行渲染,因此您的 UI 将“看起来”像您所运行的平台上的其他 UI(即 Linux 与 Windows)。然而,Qt 还提供了相当复杂的样式功能,使您可以轻松地更改任何控件的外观,并使您能够更好地控制应用程序的外观。

使用新的声明性语言 (Qt 4.7.*),您正在接近 WPF 的控制级别,这确实令人惊叹。

5) UI 设计器:

Qt 有一个更丰富的设计器,允许您布局表单,并进行基本测试,而无需编译任何代码。设计器还使您能够在表单上的控件之间添加交互。前任。单击此按钮 - 禁用此选项

Eclipse 还有一个表单设计器,尽管我对它的经验有限。我确实尝试过使用它几次,但成功率非常有限。最后我通过代码手工对每个表单进行了编码。那是痛苦的。

6) 与现有源代码交互

如果你没有这个问题,那么你就很幸运了。由于 Qt 基于 C++,因此它可以与遗留的 C 和 C++ 代码无缝集成。集成 Java 和 C 并不容易。

7) 绘图库

我尝试使用 swt 库编写一些手绘形状,但由于其中的混乱,被迫绕过 swt 绘图库的大部分内容。使用 Qt 做类似的事情一点也不麻烦。

8) 树和列表模型

Eclipse 确实提供了一些很好的开箱即用功能,用于将数据传播到树、列表和事物中。它在 Qt 中几乎同样好,尽管设置起来有点棘手。

9) 应用程序布局

Eclipse 提供了一些很好的功能来管理“视图”(停靠面板)和“透视图”(工作流程),如果您决定使用它们,生活就会变得美好而轻松。 Qt 要求你自己做这件事。 Qt 确实具有停靠面板功能,但是在构建丰富的应用程序时,您必须自己进行设置。

额外注意:

Qt 还提供了一些额外的库来支持 xml 等内容...因此,这有助于在此类内容上弥合 c++ 和 java 之间的差距。

Now that Qt has an LGPL license I would choose Qt any day of the week over Eclipse RCP.

I have used both to create fairly complex applications.

Since you can use eclipse to develop c++, I am assuming that we are comparing mostly swt/jface vs Qt, and not the eclipse development environment itself.

Some things I have noticed having used both:

1) Qt has better documentation and samples

Other than some half-baked examples on the web, I could find little useful eclipse documentation.

2) Qt has a lot more 'professional' users

There are many professional companies out there using Qt as their UI framework. Given it's three platform support (Windows, Linux, Mac), it is very flexible, and has a lot of backing.

3) Qt tends to be more complete and mature -

Using Eclipse I noticed that quite often the controls, and packages that were available were only partially done, and not quite complete. They were typically developed for someone's use, and only coded as far as that. Qt's controls were almost always a complete design.

4) Styling.

Both Qt and Eclipse render using local platform libraries, so your UI will 'look' like other UIs on the platform you are running on (i.e. Linux vs Windows). However, Qt also provides fairly sophisticated styling functionality that allows you to easily alter the look of any control, and gives you much more control over the look of your application.

With the new declarative language (Qt 4.7.*) you are approaching WPF level of control which is really amazing.

5) UI Designer:

Qt has a much richer Designer that allows you to layout your form, and do basic testing without having to compile any code. The designer also gives you the capability to add interactions between the controls on your form. Ex. Click this button - disable this option

Eclipse also has a form designer, although my experience with it is limited. I did try to use it a couple of times with very limited success. Finally I coded every form by hand through code. That is painful.

6) Interfacing with existing source code

If you don't have this problem, then you are very lucky. Because Qt is c++ based it integrates seamlessly with legacy C and C++ code. Integrating Java and C is not easy.

7) Drawing Libraries

I tried coding some hand-drawn shapes using the swt libraries and was forced to bypass large parts of the swt drawing library, because of the cludge that was in there. Using Qt to do something similar was no trouble at all.

8) Tree and List Models

Eclipse does provide some nice out of the box functionality for propagated data into trees, and lists and things. It is almost as good in Qt, although a little trickier to set up.

9) Application Layout

Eclipse provides some nice functionality to manage 'view's (dock panels), and 'perspectives' (workflows) that if you decide to use them makes life nice and easy. Qt requires you to do this yourself. Qt does have dock panel functionality, but when building a rich application you have to set this up yourself.

Extra Note:

Qt has also provided some extra libraries to support things like xml, etc... So this helps bridge the gap a little between c++ and java for things like this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文