I have always had a love hate relationship with version changes. On one hand I really want to use all the shiny new features and APIs, but on the other hand I dread….and I mean DREAD seeing working code that has been working for years suddenly need to be re-written.

Qt 6 released

When creating Qt 6, we ensured that Qt’s core values have been adhered to and upheld, including:

Its cross-platform nature, allowing users to deploy their applications to all desktop, mobile, and embedded platforms using one technology and from a single codebase

Its scalability from low-end, single-purpose devices to high-end complex desktop applications or connected system

Its world-class APIs and tools and documentation, simplifying the creation of applications and devices

Its maintainability, stability, and compatibility, allowing users to maintain large codebases with minimal effort

Its large developer ecosystem with more than 1.5 million users

Qt 6.0 is the first release of the Qt 6 series addressing new market demands while keeping the core values at the heart of what we do.

When developing Qt 6, we had an in-depth look at some of Qt’s most central parts to identify how we could improve them. We discovered a couple of core focus areas that we invested considerable time in improving. Those areas include:

Leveraging C++17

Next generation QML

New graphics architecture

Unified 2D and 3D for Qt Quick

CMake build system (with qmake still supported for applications)

That one line really stood out: “maintainability, stability, and compatibility, allowing users to maintain large codebases with minimal effort”

We hear this promise a lot from vendors and I always mock it, because as developers…we know how it will really be...we know…

Downloading…installing…failing…

The installer issued an error message…sadly my linux box was too old to run the newest version of Qt — I was faced with some hard choices…upgrade to a newer version of Linux or build from source.

Building from source

In Qt’s defense — I have been, and still am; on an unsupported version of Linux, an older Mac book pro, and a Windows box that honestly, is so old that I am surprised even runs every time I press the power button.

Determined to get this working, I compiled from source, both dynamically and statically.

After building, most things right out of the box “just worked” — but I wanted to really see how much of Qt changed.

Setting up a virtual machine

Testing hundreds of Qt applications

To say I had a lot of code to test was an understatement.

So I did what any lazy developer would do — I automated it.

Using python scripts to setup the code, convert it to CMake, convert it to Qt6 and recompile each application with both QMake and CMake, I was able to test hundreds of apps in varying complexity over a week.

Qt 5 Compatibility?

The things that did not “just work” usually involved:

QByteArray — had to explicitly cast data into it rather than trusting it to be implicitly cast for me.

QString — Some monitor changes, seems they really re-worked this class.

QTcpSocket — They moved the SocketError signal (finally!!!) to errorOccured making it easier.

QDateTime — they did away with some of the more confusing aspects of this.

Widgets — a few minor things, but nothing I could not figure out. Wow they are still maintaining widgets, this is awesome, I have long feared they will drop support in favor of QML. But I LOVE widgets.

QML — The only major show stopper for me was menus, they simply don’t work on my Cinnamon desktop (Linux Mint).

A few other minor things — but as promised — Qt made things “just work”.

For the thing that did not “just work”, they includes the Qt 5 Core Compat module. Adding it to a project was super easy:

Qt 5 Core Compatibility APIs: https://doc.qt.io/qt-6/qtcore5-index.html

For QMake:

QT += core5compat

For CMake

find_package(Qt6 COMPONENTS Core5Compat REQUIRED)
target_link_libraries(mytarget PUBLIC Qt6::Core5Compat)

After adding that — (and making sure to use it correctly) — most stubborn code just started working again.

Bravo Qt…Bravo! I am beyond words

Learning from Experience

If you are interested the course is available on Udemy and has been getting good reviews, we are all in the VoidRealms facebook group looking at various migration issues:

Re-Recording for Qt 6

Qt 5 Core for beginners with C++
https://www.udemy.com/course/qt-core-for-beginners/?referralCode=E2115FC6B3CC3BD742AF

Qt 5 Core Intermediate with C++
https://www.udemy.com/course/qt-core-intermediate/?referralCode=1F1A60AF279FEE1719CD

Qt 5 Core Advanced with C++
https://www.udemy.com/course/qt-core-advanced/?referralCode=8DB432110F38B253D251

Qt 5 Widgets for beginners with C++
https://www.udemy.com/course/qt-widgets-beginners/?referralCode=1B2FA9787D88D97D38D3

QML for beginners with Qt 5
https://www.udemy.com/course/qml-for-beginners/?referralCode=3B69B9927B587BBF40F1

Qt 5 Design Patterns
https://www.udemy.com/course/qt-5-design-patterns/?referralCode=3C2C41D87AB3A17B395F

Migrating to Qt 6
https://www.udemy.com/course/migrating-to-qt-6/?referralCode=F4775D810BD9551083B6

Awarded Content Creator in the 2020 Qt Champion Awards:

“Bryan has a few courses available on Udemy, specifically his course on Qt 5 Design Patterns and also has a popular group on Facebook which helps others with their Qt questions as well. For his work alone in creating the Qt 5 training course online for everyone to benefit from it was easy to make him our year’s Content Creator.”

Follow me on:

YouTube: https://www.youtube.com/user/VoidRealms

Facebook: https://www.facebook.com/groups/1400884323467285

Udemy: https://www.udemy.com/user/bryan-cairns/

Computer programmer loves, Qt, Python, Flutter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store