移植 Borland C++生成器到 Qt

发布于 2024-10-11 04:55:38 字数 282 浏览 7 评论 0原文

我必须在 Windows 7/mingw 下使用 g++ 将项目从 Windows XP 下的 Borland C++ Builder 5.0 移植到 Qt 4.7.1。库和命令行实用程序已完成,现在我必须处理使用 Borland VCL 的 GUI 应用程序。
有人可以推荐任何工具或库来简化这项任务吗?
有人有这方面的经验吗?

编辑添加:好吧,我不畏艰险,从头开始实现了 GUI。我不得不说,评论者是对的:我看不出有任何方法可以使用现有的 Borland GUI 来简化该过程。

I have to port a project from Borland C++ Builder 5.0 under Windows XP to Qt 4.7.1 using g++ under Windows 7/mingw. The libraries and command-line utilities are done, and now I have to tackle the GUI applications, which use Borland VCL.
Can anybody recommend any tools or libraries to make this task easier?
Does anybody have any experience of this?

Edited to add: Well, I took the bull by the horns, and implemented the GUI from scratch. And I have to say, the commentators were right: I can't see any way of using the existing Borland GUI to ease the process.

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

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

发布评论

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

评论(3

三人与歌 2024-10-18 04:55:39

VCL 和 Qt 之间有几个很大的差异,这将使自动转换过程变得相当困难。

  • Qt 使用信号、槽和继承,而 VCL 使用事件。
  • VCL 组件使用绝对坐标,Qt 使用布局。当然,您也可以在 Qt 中使用绝对坐标,但 GUI 会非常糟糕。
  • VCL 的 TListBox 和 TTreeView 类与 Qt 的 View 和 Model 类有很大不同(尽管您可以使用 QListWidget 和 QTreeWidget 代替)。

我想用 Qt 设计全新的 GUI 比创建一个平庸的 VCL 到 Qt 转换器要快得多。而且代码会更容易维护。我建议您采用一种中等复杂度的 VCL 形式,并使用 Qt 重新创建它。之后,您可以对总娱乐工作量进行估算。此外,您还将更好地了解转换工具的可行性,您很可能需要自己制作该工具。

There are several big differences between VCL and Qt that will make an automatic conversion process quite difficult.

  • Qt uses signals and slots and inheritance where VCL uses events.
  • VCL components use absolute coordinates and Qt uses layouts. Of course, you could use absolute coordinates also with Qt, but the GUIs would be quite awful then.
  • VCL's TListBox and TTreeView classes are quite different from Qt's View and Model classes (although you could use QListWidget and QTreeWidget instead).

I guess it is much faster to design totally new GUIs with Qt than to create even a mediocre VCL-to-Qt converter. And the code will be much easier to maintain. I suggest that you take one VCL form of medium complexity and recreate that with Qt. After that you can make an estimation of the total recreation work. Also you will have a better understanding about the feasibility of a conversion tool, which you most probably would need to make by yourself.

和影子一齐双人舞 2024-10-18 04:55:39

有人编写了一个将 dfm 转换为 qt ui 文件的工具:

http://sourceforge.net/projects/dfm2qt4ui/< /a>

它有一些小错误,但它可以节省移植表单设计几个小时的时间。在某些情况下,重新设计特定的表单是更好的选择 - 但在许多情况下,为您定位标签和大致等效的控件可以节省大量的点击操作。

Someone has written a tool to convert dfm's to qt ui files:

http://sourceforge.net/projects/dfm2qt4ui/

Its has a few small bugs but it can save several hours of time porting form designs. In some cases redesigning specific forms is preferable - but in many cases, having labels and roughly equivalent controls positioned for you saves a lot of point-and-click action.

谜兔 2024-10-18 04:55:39

我同意当前的共识,即从 VCL 到 QT 的自动转换不是一个好主意,因为两者背后的概念非常不同,并且您最好学习“QT 方式”并从一开始就使用它。
然而,还有一个重要步骤尚未有人提及:重构!在开始之前,请确保重构原始表单,删除尽可能多的业务逻辑,只留下真正的 GUI 代码。当然,这取决于您的架构已经有多好,但是 VCL 设计者倾向于鼓励尽可能多地放入表单中(甚至尽可能使用带有非可视组件的不可见“数据表单”!),因此您经常会发现很多不应该存在的形式的东西。

I agree with the current consensus that automatic conversion from VCL to QT is not a good idea because the concept behind both is very different, and you are much better off learning "the QT way" and using that from the start.
However there is one major step that nobody has yet mentioned: refactoring! Before starting, make sure you refactor the original forms to remove as much business logic as possible and leave only what is really GUI code. It depends on how good your architecture already is of course, but the VCL designer tends to encourage putting as much as possible in forms (even going as far as having invisible "data forms" with non-visual components!), so you often find a lot of stuff in the form that shouldn't be there.

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