Documentation/4.0/Developers/Tutorials/QtDesigner
Contents
Using custom widgets in Qt Designer
Straight to the point
- Windows
- Compile Slicer in Release mode
- Double clic on Designer-Release.py located in Slicer3-build
- Others
cd Slicer-build; Slicer4 --launch designer
Qt Designer requirements
In order to have the CTK and MRML widgets in Qt Designer, Qt Designer offers 2 options. The first (not detailed here) is to copy (or symlink) the CTK and MRML plugin libraries into %QT_DIR%/plugins/designer, the second is to set the environment variable QT_PLUGIN_PATH
to the directory Slicer3-build/bin containing the subdirectory designer with the plugin libraries.
Note: Qt requires that the directory containing the designer plugins is named "designer".
Moreover, Qt Designer can only load plugins that have been compiled in the same build mode than Qt Designer. For example, if Qt is built in Debug mode, the plugins must also be built in Debug mode to be loaded by Qt Designer.
Note: If Qt is configured to build in both debug and release modes, Qt Designer is built in release mode only. If that case, it is necessary to ensure that plugins are also built in release mode.
Running Qt Designer with the correct environment variables
- Compile Slicer in the same build mode than Qt. If Qt is in Debug mode, compile Slicer in Debug mode, if it's in Release or Debug&Release mode, compile Slicer in Release mode.
- run Qt Designer via Slicer launcher located in Slicer-build.
cd Slicer-build; Slicer4 --designer
Note: For MS Visual Studio users, there is a Designer python script for each build mode. Execute the script according to the build mode. Note: Designer.py can take a .ui file as an argument, it will load it into Qt designer.