I have the development packages for Qt5 and Qt6. As you mentioned it works when I remove Qt5 from the following statement in CMakeLists.txt.
#find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
#find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets)
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets)
The first and third line result in a Qt5 build. The second line results in a Qt6 build. The "Qt version" field in my kit seems to have no influence. I set the value to "None".
The issue is resolved. However in a weird way.