Skip to content

Add qt6 support#181

Draft
lassoan wants to merge 1 commit intomainfrom
add-qt6-support
Draft

Add qt6 support#181
lassoan wants to merge 1 commit intomainfrom
add-qt6-support

Conversation

@lassoan
Copy link
Member

@lassoan lassoan commented Feb 19, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds Qt6 support to the CTKAppLauncher project while maintaining backward compatibility with Qt5. The changes allow the project to be built with either Qt5 or Qt6, with automatic detection based on which Qt version is available.

Changes:

  • Updated CMake build system to support both Qt5 and Qt6, with automatic version detection based on Qt6_DIR
  • Replaced Qt5-specific CMake macros with version-agnostic alternatives (qt_wrap_cpp, qt_wrap_ui, qt_add_resources)
  • Updated header files to include QStringList directly instead of forward declaring it for Qt6 compatibility
  • Conditionally compiled QProcess::setupChildProcess() to only build for Qt < 6.0.0 since it was removed in Qt6

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CMakeLists.txt Added Qt6 version detection, updated version validation to accept both 5 and 6, and made find_package calls version-agnostic
CMake/ctkMacroBuildLib.cmake Replaced Qt5-specific macros (QT5_WRAP_CPP, etc.) with version-agnostic alternatives (qt_wrap_cpp, etc.)
Base/ctkSettingsHelper.h Changed QStringList from forward declaration to direct include for Qt6 compatibility
Base/ctkAppArguments.h Changed QStringList from forward declaration to direct include for Qt6 compatibility
Base/ctkAppLauncher_p.h Added preprocessor guard to conditionally declare setupChildProcess() only for Qt < 6.0.0
Base/ctkAppLauncher.cpp Added preprocessor guard to conditionally define setupChildProcess() only for Qt < 6.0.0
Base/Testing/Cpp/CMakeLists.txt Updated version check condition to accept both Qt5 and Qt6, but left Qt5-specific macro unchanged (bug)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lassoan lassoan marked this pull request as draft February 20, 2026 00:28
@jamesobutler
Copy link
Contributor

@jcfr since this repo depends on https://github.com/jcfr/qt-static-build

  • Should we add a Qt 5.15 build for Windows to complete static builds across Linux/macOS/Windows?
  • Would you be able to create a Qt6 static build?
  • Should the qt-static-build repo be moved into the CTK GitHub organization for closer maintenance to ctkAppLauncher if it is the only repo using it?

Extend the AppLauncher library to build against both Qt5 and Qt6 while
keeping Qt5 behavior unchanged.

- Allow CTKAppLauncher_QT_VERSION to be 5 or 6 (defaulting to 6 when
  Qt6_DIR is provided) and validate the value explicitly.
- Switch from Qt5-specific macros (QT5_WRAP_*) to qt_wrap_cpp,
  qt_wrap_ui, and qt_add_resources so the same build logic works with
  Qt5 and Qt6.
- Use Qt${CTKAppLauncher_QT_VERSION} in find_package() and
  QT_LIBRARIES to avoid pulling in Qt5 targets in a Qt6 build.
- Guard ctkInteractiveProcess::setupChildProcess() so it is only
  declared/defined for Qt5, preventing signature conflicts with the
  Qt6 QProcess API.
- Include <QStringList> directly instead of relying on forward
  declarations for improved compatibility.

This resolves Qt major version mismatches when CTKAppLauncherLib is
consumed from Qt6-based projects such as Slicer.

Co-authored-by: Andras Lasso <lasso@queensu.ca>
Co-authored-by: James Butler <james.butler@revvity.com>
@jamesobutler
Copy link
Contributor

@jcfr Do you have thoughts on the mentioned items in my previous comment about proceeding further on the Qt6 work here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants