<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.slicer.org/w/index.php?action=history&amp;feed=atom&amp;title=Documentation%2F4.3%2FDevelopers%2FTutorials%2FQtDesigner</id>
	<title>Documentation/4.3/Developers/Tutorials/QtDesigner - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.slicer.org/w/index.php?action=history&amp;feed=atom&amp;title=Documentation%2F4.3%2FDevelopers%2FTutorials%2FQtDesigner"/>
	<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.3/Developers/Tutorials/QtDesigner&amp;action=history"/>
	<updated>2026-04-08T07:38:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://www.slicer.org/w/index.php?title=Documentation/4.3/Developers/Tutorials/QtDesigner&amp;diff=35161&amp;oldid=prev</id>
		<title>UpdateBot: Nightly -&gt; 4.3</title>
		<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.3/Developers/Tutorials/QtDesigner&amp;diff=35161&amp;oldid=prev"/>
		<updated>2013-09-05T03:31:19Z</updated>

		<summary type="html">&lt;p&gt;Nightly -&amp;gt; 4.3&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;noinclude&amp;gt;{{documentation/versioncheck}}&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
=Using custom widgets in Qt Designer=&lt;br /&gt;
==Straight to the point==&lt;br /&gt;
*Windows&lt;br /&gt;
**Compile Slicer in Release mode OR build Qt in Debug&lt;br /&gt;
*All&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd Slicer-build;&lt;br /&gt;
./Slicer --designer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the option &amp;lt;code&amp;gt;--designer&amp;lt;/code&amp;gt; is not available, you should consider using QtCreator. See [[Documentation/{{documentation/version}}/Developers/Tutorials/QtCreator|here]] for more details.&lt;br /&gt;
&lt;br /&gt;
==Qt Designer requirements==&lt;br /&gt;
In order to have the CTK and MRML widgets in Qt Designer, Qt Designer offers 2 options:&lt;br /&gt;
*the first (not detailed here) is to copy (or symlink) the CTK and MRML plugin libraries into &amp;lt;i&amp;gt;%QT_DIR%/plugins/designer&amp;lt;/i&amp;gt;,&lt;br /&gt;
*the second is to set the environment variable &amp;lt;code&amp;gt;QT_PLUGIN_PATH&amp;lt;/code&amp;gt; to the directory &amp;lt;i&amp;gt;Slicer-build/bin&amp;lt;/i&amp;gt; containing the subdirectory &amp;lt;i&amp;gt;designer&amp;lt;/i&amp;gt; with the plugin libraries.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Qt requires that the directory containing the designer plugins is named &amp;quot;designer&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Consider reading the [http://doc.qt.nokia.com/{{documentation/{{documentation/version}}/qtversion}}/designer-manual.html Qt Designer documentation].&lt;br /&gt;
If the widgets do not appear in Qt Designer, then open the &amp;quot;Help -&amp;gt; About Plugin&amp;quot; dialog and report the error associated to the plugin dll.&lt;br /&gt;
&lt;br /&gt;
=== Windows notes ===&lt;br /&gt;
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.&amp;lt;br&amp;gt;&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Running Qt Designer with the correct environment variables==&lt;br /&gt;
*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&amp;amp;Release mode, compile Slicer in Release mode.&lt;br /&gt;
*run Qt Designer via Slicer launcher located in &amp;lt;i&amp;gt;Slicer-build&amp;lt;/i&amp;gt;.&lt;br /&gt;
{| style=&amp;quot;border: 1px solid darkgray;&amp;quot;&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Mac Os X&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Linux&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Windows&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&lt;br /&gt;
 $ cd Slicer-build&lt;br /&gt;
 $ ./Slicer --designer&lt;br /&gt;
|&lt;br /&gt;
 &amp;gt; cd Slicer-build&lt;br /&gt;
 &amp;gt; .\Slicer.exe --designer&lt;br /&gt;
|}&lt;br /&gt;
If the option &amp;lt;code&amp;gt;--designer&amp;lt;/code&amp;gt; is not available, you should consider using QtCreator. See [[Documentation/{{documentation/version}}/Developers/Tutorials/QtCreator|here]] for more details.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:Screenshot-Qt Designer.png|thumb|300px|Qt Desginer loaded with CTKWidgets and qMRMLWidgets]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Build Slicer==&lt;br /&gt;
* Once you are satisfied with UI, save the file, quit Designer and build Slicer to take the changes into account.&lt;br /&gt;
{| style=&amp;quot;border: 1px solid darkgray;&amp;quot;&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Mac Os X&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Linux&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Windows&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&lt;br /&gt;
 $ make -j4&lt;br /&gt;
or just build the related project&lt;br /&gt;
 $ make -j4 qSlicerMY_MODULE_NAMEModuleWidget&lt;br /&gt;
| Open the inner solution file ''...Slicer-Superbuild\Slicer-build\Slicer.sln'' and build the solution (F7) or build project &amp;lt;code&amp;gt;qSlicerMY_MODULE_NAMEModuleWidgets&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
It generates a ''ui_qSlicerMY_MODULE_NAMEModule.h'' file in ''...Slicer-Superbuild/Slicer-buildModules/Loadable/MY_MODULE_NAME/''. &lt;br /&gt;
&lt;br /&gt;
That file is used by ''...Slicer4/Modules/Loadable/MY_MODULE_NAME/qSlicerMY_MODULE_NAMEModuleWidget.cxx''.&lt;br /&gt;
&lt;br /&gt;
Note: The &amp;lt;code&amp;gt;objectName&amp;lt;/code&amp;gt;s of each widget in the UI correspond (see the Property editor) to the variable names in C++. From your code, you can access the widgets by their objectName. &lt;br /&gt;
* And launch Slicer to see the result&lt;br /&gt;
{| style=&amp;quot;border: 1px solid darkgray;&amp;quot;&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Mac Os X&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Linux&lt;br /&gt;
!align=left style=&amp;quot;border-bottom: 1px solid grey;&amp;quot;|Windows&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;pre&amp;gt;$ ./Slicer&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &amp;lt;pre&amp;gt;&amp;gt; .\Slicer.exe&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
== Frequently Asked Questions ==&lt;br /&gt;
* My [http://slicer.org/doc/html/classqMRMLNodeComboBox.html qMRMLNodeComboBox] widget is always disabled (gray) in my module.&lt;br /&gt;
To be enabled, qMRMLNodeComboBox needs a MRML scene. You can set a MRML scene to the combobox programmatically or directly from Qt Designer. Doing it in Qt Designer is the recommended way, to do so you need to be in [http://doc.qt.nokia.com/{{documentation/{{documentation/version}}/qtversion}}/designer-connection-mode.html Connection mode] and connect the signal [http://slicer.org/doc/html/classqSlicerWidget.html#a9c28318f7810ccce517ea7a1b0051da4 mrmlSceneChanged(vtkMRMLScene*)] of the module panel (of type [http://slicer.org/doc/html/classqSlicerWidget.html qSlicerWidget]) with the slot [http://slicer.org/doc/html/classqMRMLNodeComboBox.html#a2249be3ccec4783b592f738f1ef7bea3 setMRMLScene(vtkMRMLScene*)].&lt;br /&gt;
The programmatic connection can be done in the &amp;lt;code&amp;gt;setup()&amp;lt;/code&amp;gt; method of the module widget (or &amp;lt;code&amp;gt;init()&amp;lt;/code&amp;gt; of the module widget pimpl):&lt;br /&gt;
 void qSlicerDataModuleWidget::setup()&lt;br /&gt;
 {&lt;br /&gt;
 ...&lt;br /&gt;
 connect(this, SIGNAL(mrmlSceneChanged(vtkMRMLScene*)),&lt;br /&gt;
         myWidget, SLOT(setMRMLScene(vtkMRMLScene*)));&lt;br /&gt;
 ...&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>UpdateBot</name></author>
		
	</entry>
</feed>