Page MenuHomePhabricator

Build system support for Qt5 + QML demo application
Closed, ResolvedPublic


I'm developing a MITK demo application based on Qt5 QML.

To nicely integrate this, the build system needs to be enhanced with support for Qt5, because currently there is support for Qt4 only.

The solution proposed in the feature branch solves the problem by

  • introducing DESIRED_QT_VERSION as a new CMake-Variable
  • deprecating the QT_MODULE keyword of MITK_CREATE_MODULE()
  • introducing two new keywords QT4_MODULES and QT5_MODULES, which may list specific Qt modules

Along with the build system changes comes a demo application QuickRender to show

  1. feasibility of QML/MITK
  2. Qt5 dependent modules

A module supporting BOTH Qt5 and Qt4 is provided with QtQt5TestModule. Such modules will be needed during a module conversion time.

Event Timeline

Not any relevant core changes in this branch but still worthy a discussion..

Code is currently at

I need to clean up some commits before I'm able to push to

New remote branch pushed: bug-16272-qt5-build-system

I just finished cleaning my commits and integrating some changes by Sascha from yesterday evening. Everything is now contained in branch


Sascha restructured the macros a bit and made them more readable. Most of all he introduced a macro MITK_USE_MODULES (with terminating S), which takes a target name and is able to use the qt5_use_modules() macro of CMake internally. This has the advantage that Qt takes care of most of our compiler flag worries.

I tested the changes on Windows 8 with Visual Studio 12 and had to make only tiny changes in order to build the Qt5 version. Everything seems fine, we can talk about merging now.

Sascha, any update on this topic?

(In reply to Daniel Maleike from comment #6)

Sascha, any update on this topic?

There are still issues which prevent external projects like MBI-MITK to configure and build properly. Mostly due to missing link-directories.

[4f79fe]: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-08 05:08:33 Sascha Zelzer [97c9c7]
Do not include Qt package config files.

The Qt5 config files assume that the module target already exists,
hence we cannot include them before creating the target.

2014-01-08 04:34:11 Sascha Zelzer [9ca5bd]
Always look at special Qt source files.

Modules might have a transitive dependency on Qt 4/5 modules.

2014-01-08 04:04:19 Sascha Zelzer [e39567]
On some Linux distros, there might not be a Qt5Config.cmake file.

2014-01-08 03:15:47 Sascha Zelzer [34e471]
Added linker directories plus several small fixes.

2014-01-08 03:12:30 Sascha Zelzer [c0dc55]
Merge remote-tracking branch 'origin/bug-16699-split-up-MitkExt-module' into bug-16272-qt5-build-system


2014-01-07 16:51:16 Sascha Zelzer [45aaac]
Use the new mitk_create_executable() macro for the tutorial.

2014-01-07 02:12:47 Sascha Zelzer [70037d]
Added new mitk_create_executable() macro.

The macro internally uses mitk_create_module() which adds the GDCM
link directories as a work around until GDCM fixes its exported targets.

2013-12-26 17:05:42 Sascha Zelzer [c65648]
Determine the Qt5 library search path for the generated batch scripts.

2013-12-26 17:04:29 Sascha Zelzer [4010dc]
Use CMAKE_PREFIX_PATH at the superbuild for easy Qt5 look-ups.

2013-12-26 17:02:53 Sascha Zelzer [0112d0]
Use the newer mitk_use_modules() macro.

2013-12-20 15:19:47 Sascha Zelzer [b9dfd2]
Marked the MITK_USE_MODULE macro deprecated.

2013-12-20 15:25:15 Sascha Zelzer [deff6e]
Work around a bug in the MOC by using a typedef.

2013-12-20 15:29:32 Sascha Zelzer [a7df80]
Export utility targets for external projects.

2013-12-20 15:18:27 Sascha Zelzer [e0e2c4]
Fixed Qt4 module names and include directories.

2013-12-20 15:16:50 Sascha Zelzer [f402c6]
Avoid multiple includes of ITK targets.

2013-10-21 16:35:46 Daniel Maleike [3fb5e3]
Adapt CTest interface to Visual Studio

2013-10-18 11:11:01 Daniel Maleike [941373]
Set CMake policy CMP0020 NEW: Automatically link Qt executables to qtmain target on Windows

2013-10-16 15:25:40 Daniel Maleike [336fe4]
Undo deactivation of probably meaningful code

2013-10-16 04:31:39 Sascha Zelzer [102f42]
Introduced a new mitk_use_modules CMake function.

This CMake function takes a target and a list of dependencies (MITK
modules, packages, or Qt components) and sets up include directories,
linker dependencies, and compile flags for the specified target.



2013-10-16 00:51:58 Sascha Zelzer [5fd29f]
Build external projects depending on Qt version. Qwt now compiles with Qt5.

2013-10-16 00:50:52 Sascha Zelzer [d98d0f]
Require CMake 2.8.9 when using Qt5.

2013-10-15 23:20:56 Sascha Zelzer [f26f75]
Support for specifying Qt4 modules as dependencies.

2013-10-16 14:08:34 Daniel Maleike [5de5a8]
Merge commit '78619fb' into bug-16272-qt5-build-system

2013-10-15 15:01:46 Daniel Maleike [d188da]
Some base documentation for classes in QmlMitk

2013-10-15 14:52:35 Daniel Maleike [a83789]
Fixing Qt4 dependencies

2013-10-15 14:04:07 Daniel Maleike [26d565]
Test module Qt4Qt5TestModule

2013-10-15 14:03:54 Daniel Maleike [bd5e5f]
Separate keywords QT4_MODULES and QT5_MODULES



2013-10-14 15:25:57 Daniel Maleike [efe92e]
Add LICENSE and README to OpenView module, rename to OpenViewCore

(only the core directory has been imported to MITK)



2013-10-14 15:11:06 Daniel Maleike [31e8b0]
Generate Qt5 module definitions

2013-10-14 12:45:22 Daniel Maleike [7ddaf6]

The MITK build can now depend on either Qt4 or Qt5.
Modules can list their dependencies towards specific
Qt modules via the QT_MODULES variable.



2013-08-21 18:44:43 Daniel Maleike [afc585]
QmlMitkFourRenderWindowWidget and QmlMitkRenderWindowItem

Attempt to integrate MITK render windows into a QML scene.

This change brings two QtQuick items

  • QmlMitkRenderWindowItem as a mitk::RenderWindow variant based on Kitware's OpenView component QVTKQuickItem.
  • QmlMitkFourRenderWindowWidget as a replacement for QmitkStdMultiWidget with much reduced functionality

Most things are working nicely now, major issues to solve:

  • Qt Quick renders in a second thread, which collides with some things in MITK. This demo brings only a workaround and not a solution.. See QmlMitkBigRenderLock.
  • Events handled by QmlMitkRenderWindowItem are probably incomplete
  • QmlMitkFourRenderWindowWidget and QmlMitkRenderWindowItem need cleaned-up interfaces to be really usable for applications
  • The new modules must be nicely integrated in to the build system
    • find and use Qt5 optionally, make this a condition to QmlMitk
    • bring the minimal changes back to OpenView (pull-request submitted)
    • build OpenView as a package dependency
      • (patch OpenView if neccessary)

[b51bb3]: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-08 12:14:39 Sascha Zelzer [deb9f8]
COMP: Serialize build steps for the tutorial.

[c0d9bc]: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-08 13:34:33 Sascha Zelzer [85794f]
COMP: Moved tutorial steps in separate directories.

This avoids redundant include directories and argument list too long
errors due to multiple mitk_create_executable() calls in
one CMakeLists.txt.

[b2a52b]: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-08 16:11:32 Sascha Zelzer [254a88]
COMP: Specify a minimum Qt version.

2014-01-08 16:07:54 Sascha Zelzer [f4bf26]
COMP: Pass the correct Qt version to the project build tests.

[52f324]: COMP: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-08 21:32:56 Sascha Zelzer [2c4de1]
Fixed memory leak due to non-virtual destructor.

2014-01-08 21:30:44 Sascha Zelzer [012a7f]
Added custom dependency on auto-load modules.

2014-01-08 16:19:56 Marco Nolden [80f2bf]
Do not use Qt in VTK unless it is enabled for MITK and version 4.x

2014-01-08 15:58:58 Marco Nolden [e70b71]
Remove unneeded libraries also on clang

[653618]: COMP: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-01-09 02:08:27 Sascha Zelzer [083a31]
Return correct target for custom functors.

This fixes functor comparison which relies on the target() return value.

2014-01-09 02:07:01 Sascha Zelzer [15bc8b]
Unregister services after test method ends.

Remaining issues:

  • Qt in VTK was still activated, using Qt4
  • Qwt is enabled without really needing it

[7f205d]: Merge branch 'bug-16272-qt5-build-system'

Merged commits:

2014-03-30 16:08:25 Marco Nolden [f0ece2]
Don't switch on Qwt in a Qt5 build

2014-01-11 10:38:24 Marco Nolden [166007]
Deactivate all Qt-related stuff in VTK for Qt 5.x

patch fixes for QuickRenderer to compile against v2014.03.0 release