关于从Qt 5移植到Qt 6的参考文献和提示集

A Collection of References and Hints about Porting from Qt 5 to Qt 6

关于从Qt 5移植到Qt 6的参考文献和提示集

April 18, 2023 by Vladimir Minenko | Comments

​2023年4月18日,弗拉基米尔·米年科 | 评论

With approaching the EOL of Qt 5.15 and the release of Qt 6.5, there is a notable wider interest in porting of existing Qt5-based code base to Qt 6. I keep hearing questions from Qt users who are interested in getting some additional hints and learning how others went on this path. Lets have a look.

随着Qt 5.15的EOL和Qt 6.5的发布,人们对将现有的基于Qt5的代码库移植到Qt 6有了更广泛的兴趣。我不断听到Qt用户的问题,他们有兴趣获得一些额外的提示,并了解其他人是如何走上这条道路的。让我们看看。

First of all, the fact that effort will be needed to port to Qt 6 was well known - this is a major release. On our side, we took care of this with a dedicated page about this in the Qt Documentation - "Porting to Qt 6". This should be your first read after you finish reading this blog-post. This Qt Documentation page also contains several other links which we consider as a related mandatory read.

​首先,需要努力移植到Qt6这一事实是众所周知的——这是一个重要的版本。在我们这边,我们在Qt文档中专门提供了一个页面——“移植到Qt 6”。这应该是你读完这篇博文后的第一次阅读。此Qt文档页面还包含其他几个链接,我们认为这些链接是相关的必读链接。

Your second read should be a review of the page "What's New in Qt 6.0" which contains other references relevant to changes in Qt 6 in general.

​第二次阅读应该是对“Qt6.0的新增内容”页面的回顾,该页面包含与Qt6的总体变化相关的其他参考资料。

The introduction of Qt 6 was a large work. We decided to introduce the essential changes as soon as possible and tackle the rest in upcoming versions. Qt 6.2 was the next most important feature release in the Qt 6 generation, since it closed most gaps to Qt 5 in terms of available modules and functionality, see "What's New in Qt 6.2" for details. A dedicated page about changes in modules can be found here and is mentioned in the porting Guide - "Porting to Qt 6", as well.

​Qt 6的推出是一项艰巨的工作。我们决定尽快引入必要的更改,并在即将发布的版本中解决其余问题。Qt 6.2是Qt 6中下一个最重要的功能发布,因为它在可用模块和功能方面与Qt 5缩小了大部分差距,请参阅“Qt 6.2的新增功能”了解详细信息。关于模块更改的专用页面可以在这里找到,并在移植指南“移植到Qt 6”中提到。

This is important to mention here since some older sources on the Internet might tell you that a lot of Qt 5 modules need to be included in Qt6 yet. Most of this is related to the Qt 6.0 scope and is not the case today. Still, a 100% match to Qt 5 was and is not possible since it would block many advancements in Qt6. Qt 6 is designed to be more, and it makes it different compared to Qt5 here and there. Keep reading "What's new in Qt6" on regular basis to stay informed.

​这一点在这里很重要,因为互联网上的一些旧消息来源可能会告诉你,Qt6中还需要包括很多Qt 5模块。这其中大部分与Qt 6.0范围有关,而今天的情况并非如此。尽管如此,与Qt 5的100%匹配过去和现在都是不可能的,因为这会阻碍Qt 6的许多进步。Qt 6被设计得更大,与Qt5相比,它在这里和那里都有所不同。定期阅读“Qt6的最新动态”,以了解最新情况。

In addition, there are "Qt 5 Core Compatibility APIs" which simplify porting work, see this blogpost introducing it.

​此外,还有“Qt 5核心兼容性API”可以简化移植工作,请参阅本文介绍。

If you were using QMake in Qt 5, you should strongly consider moving to CMake when porting to Qt 6. QMake is still available and supported in Qt 6, but all additional features and improvements are made for the CMake build toolchain. There is a manual for using CMake with Qt6 in the Qt Documentation. For the first steps, we also provide the "qmake2cmake" utility. This utility provides a basic conversion of qmake project files to CMake files, see the blogpost for an introduction. You might also be interested in watching the talk "Developing Qt6 Projects With CMake" at Qt World Summit 2021 by Craig Scott, co-maintainer of CMake. At Qt World Summit 2022, Joerg Bornemann, the lead of the Build Team at The Qt Company, had the talk "Migrating from QMake to CMake".  This provides quite some details and discusses what the "qmake2cmake" utility is not able to do by nature.

​如果您在Qt 5中使用QMake,那么在移植到Qt 6时应该重点考虑迁移到CMake。Qt 6中仍然提供并支持QMake,但所有其他功能和改进都是针对CMake构建工具链进行的。Qt文档中有一本关于将CMake与Qt6一起使用的手册。对于第一步,我们还提供了“qmake2cmake”实用程序。此实用程序提供了qmake项目文件到CMake文件的基本转换,请参阅博客文章了解介绍。您可能也有兴趣观看CMake联合维护者Craig Scott在2021 Qt世界峰会上发表的演讲“使用CMake开发Qt6项目”。在2022年Qt世界峰会上,Qt公司构建团队负责人Joerg Bornemann发表了“从QMake迁移到CMake”的演讲。这提供了相当多的细节,并讨论了“qmake2cmake”实用程序本质上不能做的事情。

The last, but not least, there are several community blogposts and other information:

最后,但并非最不重要的是,有几个社区博客文章和其他信息:

Reading the above blogposts and watching videos, be aware of the date when they are published if they refer to some specific Qt6 version. At the time of writing this, we have Qt 6.5, certainly, including Qt for Python 6.5. Timewise, this also means, there are 4 feature releases after Qt 6.0 and 2 years passed 😉. All in Qt worked hard to evolve Qt more and more, and with Qt 6.5, some dedicated effort was spent for stabilization and better quality to last longer.

​阅读以上博客文章和观看视频,如果它们引用了一些特定的Qt6版本,请注意它们的发布日期。在撰写本文时,我们当然有Qt 6.5,包括用于Python 6.5的Qt。从时间上看,这也意味着,在Qt 6.0和2年后,有4个功能发布😉. All in Qt努力使Qt越来越多地发展,随着Qt 6.5的推出,我们花了一些精力来稳定和提高质量,以持续更长的时间。

Code less, create more, and with Qt 6, even more 😎 

 代码更少,创建更多,使用Qt 6,甚至更多😎

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值