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

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.
Qt5-to-Qt6-Porting-Hints-Blog-Post
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.
 
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.
 
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.
 
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.
 
In addition, there are "Qt 5 Core Compatibility APIs" which simplify porting work, see this blogpost introducing it.
 
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.
 
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.
 
Code less, create more, and with Qt 6, even more 😎 

Blog Topics:

Comments