Difference between revisions of "Documentation/4.0/Developers/Tutorials/QtDesigner"

From Slicer Wiki
Jump to: navigation, search
(No difference)

Revision as of 03:20, 2 November 2011

Home < Documentation < 4.0 < Developers < Tutorials < QtDesigner

QtSlicer/Tutorials

Using custom widgets in Qt Designer

Straight to the point

  • Windows
    • Compile Slicer in Release mode OR build Qt in Debug
  • All
cd Slicer-build;
Slicer4 --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 Slicer-build/bin containing the subdirectory designer with the plugin libraries.

Note: Qt requires that the directory containing the designer plugins is named "designer".

= Windows notes

On Windows, 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.
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. Otherwise, you can open the solution file for Qt, and recompile Designer in debug mode.

Running Qt Designer with the correct environment variables

  • On Windows, 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: Designer.py scripts are not supported anymore.

Qt Desginer loaded with CTKWidgets and qMRMLWidgets