A Collection of References and Hints about Porting from Qt 5 to Qt 6
April 18, 2023 by Vladimir Minenko | Comments
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.
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:
- Recording from the Witekio's webinar "How to Successfully Migrate to Qt6"
- Blogpost by BasysKom "Porting a Qt5 application to Qt6"
- An article on "Meeting C++" by Jens Weller "Porting my first Application from Qt5 to Qt6"
- Qt Blog post about QList changes in Qt6 and the related video from KDAB "Qt Container in Qt 5 and Qt 6 - Sequence Containers: QList and QVector"
- The talk by Kai Köhne at KDE's Akademy 2021 "Porting User Applications to Qt 6"
- The talk by Nicolas Fella at KDAB's QtDevCon22 "KDE's Journey to Qt6"
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
Subscribe to our newsletter
Subscribe
Subscribe Newsletter
Try Qt 6.8 Now!
Download the latest release here: www.qt.io/download.
Qt 6.8 release focuses on technology trends like spatial computing & XR, complex data visualization in 2D & 3D, and ARM-based development for desktop.
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.