Skip to content

Migration to Qt6

Ammar Nejati requested to merge Qt6_migration into main

The following changes were applied to adapt the GUI to Qt6:

  • Adapted GitLab-CI script to Qt6.
  • Adapted CMake scripts to Qt6
  • Updated qcustomplot files based on the version in the OpenHKL repo.
  • Replaced some signals and slots which were obsolete in Qt6.
  • Replaced QRegExp with QRegularExpression and QRegularExpressionMatch, since QRegExp is deprecated in Qt6.
  • Replaced QStringRef with QString, since QStringRef is deprecated in Qt6.
  • Corrected the comparison of QStringView with std::string: QStringView must be converted to a string before being compared to a std::string.
  • Added proper include statements to avoid incomplete-type error.
  • Used explicit type instead of auto, otherwise the compiler could not determine the type on its own.
  • Added an auxiliary function QListToQSet to convert a QList to a QSet; the direct conversion is not allowed in Qt6.
  • Discarded QMetaType::registerComparators which is removed in Qt6: In Qt 6, QMetaType::registerComparators have been removed. The metatype system will instead know about those automatically. See https://www.qt.io/blog/whats-new-in-qmetatype-qvariant.
  • Windows installer: The libraries libEGL.dll and libGLESv2.dll are not part of the Qt6 distribution; instead, Qt6OpenGL.dll, Qt6OpenGLWidgets.dll and opengl32sw.dll must be included in the Windows installer. See further https://doc.qt.io/qt-6/windows-deployment.html and https://doc.qt.io/qt-6/opengl-changes-qt6.html.
  • The emission of the modified signal is modified in ProjectDocument::saveProjectFile, since the original mechanism was logically incorrect.
NOTE:

The CMake command to find Qt6 include files and libraries is the following:

OPT_DIR="$HOME/.local/opt"
QT_CMAKE_DIR="$OPT_DIR/Qt/6.2.3/gcc_64/lib/cmake"
cmake -S . -B build -DCMAKE_PREFIX_PATH="$OPT_DIR;$QT_CMAKE_DIR"
See further:

https://doc.qt.io/qt-6/cmake-commands-qtcore.html
https://doc.qt.io/qt-6/qt-add-resources.html

Closes issue #204 (closed)

Edited by Ammar Nejati

Merge request reports