移植 Borland C++生成器到 Qt
我必须在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
VCL 和 Qt 之间有几个很大的差异,这将使自动转换过程变得相当困难。
我想用 Qt 设计全新的 GUI 比创建一个平庸的 VCL 到 Qt 转换器要快得多。而且代码会更容易维护。我建议您采用一种中等复杂度的 VCL 形式,并使用 Qt 重新创建它。之后,您可以对总娱乐工作量进行估算。此外,您还将更好地了解转换工具的可行性,您很可能需要自己制作该工具。
There are several big differences between VCL and Qt that will make an automatic conversion process quite difficult.
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.
有人编写了一个将 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.
我同意当前的共识,即从 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.