Skip to content

Restore CTK_USE_QTTESTING support with Qt 6 #1314

@jcfr

Description

@jcfr

Is your feature request related to a problem? Please describe.

CTK_USE_QTTESTING is currently disabled for Qt 6 builds because the CTK-side QtTesting integration depends on Qt XmlPatterns, which is not available in Qt 6. As a result:

  • Projects building CTK with Qt 6 cannot enable QtTesting-based recording/replay and regression tests.

  • CTK’s QtTesting integration does not reflect the actual upstream dependencies:

    • Qt XmlPatterns C++ classes are only used by ctkXMLEventSource in CTK/Libs/QtTesting.
    • Other XmlPatterns usages are limited to components such as CTK/Libs/CommandLineModules and CTK/Applications/ctkCommandLineModuleExplorer, which are not required by all CTK consumers.
    • The upstream QtTesting library (commontk/QtTesting1) itself does not depend on Qt XmlPatterns.
  • This creates an unnecessary limitation for Qt 6 adopters who rely on QtTesting workflows.

Describe the solution you'd like

Make CTK_USE_QTTESTING=ON supported when building with Qt 6 by:

  • Aligning CTK’s QtTesting integration with the upstream QtTesting library so it no longer requires Qt XmlPatterns for core functionality.

  • Refactoring or isolating ctkXMLEventSource and any XmlPatterns-based logic so that:

    • XmlPatterns is only used in Qt 5 builds (if needed), or
    • XmlPatterns-dependent code is replaced with Qt 6–compatible XML handling.
  • Updating the CMake configuration so that:

    • CTK_USE_QTTESTING is not forcibly disabled for Qt 6 once dependencies are addressed.
    • Appropriate Qt 6 modules (e.g., Qt6::Test) are used when QtTesting is enabled.
  • Preserving behavior and configuration for existing Qt 5 users.

Describe alternatives you've considered

  • Keeping CTK_USE_QTTESTING permanently disabled for Qt 6:
    • Simple, but prevents users from leveraging QtTesting with modern Qt versions.

Additional context

  • CTK now supports building with Qt 5 or Qt 6 via CTK_QT_VERSION.
  • As part of Qt 6 enablement, CTK_USE_QTTESTING is currently forced OFF for Qt 6 to avoid unsupported Qt modules.
  • Prior work in Slicer already narrowed XmlPatterns usage to QtTesting-specific paths and optional components, indicating that a clean separation is feasible.
  • This feature would restore QtTesting-based regression and UI testing workflows for projects migrating to Qt 6 while maintaining compatibility with existing Qt 5 setups.

Footnotes

  1. https://github.com/commontk/QtTesting

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions