Documentation/4.10/Developers/Tutorials/QtCreator

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < 4.10 < Developers < Tutorials < QtCreator


For the latest Slicer documentation, visit the read-the-docs.


Qt Creator

Qt Creator is a cross-platform IDE that fully integrates Qt into the development of applications. Slicer CMake project is supported by Qt Creator, the following items aim at describing how it could be used.

  • From a terminal, launch QtCreator through Slicer to setup environment. This will allow qtcreator to design UI using CTK and Slicer custom designer plugins:
Unix Windows
cd /path/to/Slicer-Superbuild/Slicer-build
./Slicer --launch /path/to/qtcreator
cd c:\path\to\Slicer-Superbuild\Slicer-build
.\Slicer.exe --launch /path/to/qtcreator.exe


  • Open /path/to/Slicer-src/CMakeLists.txt in qtcreator, when prompted, choose the INNER build directory where Slicer was configured and compiled: /path/to/Slicer-Superbuild/Slicer-build
    • NOTE: You can select either the binary tree of the SuperBuild or the binary tree of the Slicer-build that is inside the binary tree of the SuperBuild. The former allows you to build all of the packages that Slicer depends on and build Slicer itself all from within Qt Creator. The latter provides a better IDE experience when working on Slicer itself (recognizing types, pulling up documentation, cross-referencing the code, ...).
  • Click the 'Run CMake' button (no arguments needed), wait until CMake has finished, then click the 'Finish' button
  • Optional:
    • Specify make arguments (ex. -j8) by clicking the 'Projects' tab on the left hand side, click the 'Build Settings' tab at the top, click the 'Details' button beside the Make build step, and add your additional arguments. This is useful if you want to build from within Qt Creator.
    • Specify run configuration by clicking the 'Projects' tab on the left hand side, click the 'Run Settings' tab at the top, and select your Run configuration (ex. choose SlicerQT-real). This is useful if you want to run Slicer from within Qt Creator.

Troubleshooting

  • With the upgrade of QtCreator from 2.2.0 to 2.4.1, attempts to open a project defined by CMakeLists.txt file may not be possible, because the file is grayed out in the load dialog. Reportedly, this issue can be resolved by removing the configuration files remaining from the previous installation of Qt Creator. On Mac these files are located in ~/.config/Nokia. WARNING: removing those files will erase all configuration and project history from your QtCreator. You can also try to pass CMakeLists.txt as an argument to Qt Creator binary (launching as shown above).