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

From Slicer Wiki
Jump to: navigation, search
Line 3: Line 3:
 
==Straight to the point==
 
==Straight to the point==
 
*Windows
 
*Windows
**Compile Slicer in Release mode
+
**Compile Slicer in Release mode OR build Qt in Debug
**Double clic on <i>Designer-Release.py</i> located in <i>Slicer3-build</i>
+
*All
*Others
 
 
<pre>
 
<pre>
 
cd Slicer-build;
 
cd Slicer-build;
Line 12: Line 11:
  
 
==Qt Designer requirements==
 
==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 <i>%QT_DIR%/plugins/designer</i>, the second is to set the environment variable <code>QT_PLUGIN_PATH</code> to the directory <i>Slicer3-build/bin</i> containing the subdirectory <i>designer</i> with the plugin libraries.<br>
+
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 <i>%QT_DIR%/plugins/designer</i>,
 +
*the second is to set the environment variable <code>QT_PLUGIN_PATH</code> to the directory <i>Slicer-build/bin</i> containing the subdirectory <i>designer</i> with the plugin libraries.<br>
 
'''Note:''' Qt requires that the directory containing the designer plugins is named "designer".<br>
 
'''Note:''' Qt requires that the directory containing the designer plugins is named "designer".<br>
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.<br>
+
=== Windows notes ==
'''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.  
+
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.<br>
 +
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==
 
==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.
+
*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 <i>Slicer-build</i>.
 
*run Qt Designer via Slicer launcher located in <i>Slicer-build</i>.
 
<pre>
 
<pre>
Line 24: Line 26:
 
Slicer4 --designer
 
Slicer4 --designer
 
</pre>
 
</pre>
'''Note:''' For MS Visual Studio users, there is a <i>Designer</i> python script for each build mode. Execute the script according to the build mode.
+
'''Note:''' <i>Designer.py</i> scripts are not supported anymore.
'''Note:''' <i>Designer.py</i> can take a <i>.ui</i> file as an argument, it will load it into Qt designer.
 
 
{|
 
{|
 
|[[Image:Screenshot-Qt Designer.png|thumb|300px|Qt Desginer loaded with CTKWidgets and qMRMLWidgets]]
 
|[[Image:Screenshot-Qt Designer.png|thumb|300px|Qt Desginer loaded with CTKWidgets and qMRMLWidgets]]
 
|}
 
|}

Revision as of 19:25, 19 January 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