<?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.5%2FDevelopers%2FQtPlugins</id>
	<title>Documentation/4.5/Developers/QtPlugins - 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.5%2FDevelopers%2FQtPlugins"/>
	<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.5/Developers/QtPlugins&amp;action=history"/>
	<updated>2026-04-04T22:47:14Z</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.5/Developers/QtPlugins&amp;diff=43588&amp;oldid=prev</id>
		<title>UpdateBot: Nightly -&gt; 4.5</title>
		<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.5/Developers/QtPlugins&amp;diff=43588&amp;oldid=prev"/>
		<updated>2015-11-12T22:04:05Z</updated>

		<summary type="html">&lt;p&gt;Nightly -&amp;gt; 4.5&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;
&lt;br /&gt;
= Qt Plugins =&lt;br /&gt;
Plugins for Qt (e.g. designer, iconengines, image formats)  are automatically discovered and loaded by Qt based on the directory plugins are into. There are [http://doc.qt.nokia.com/4.6/plugins-howto.html#locating-plugins multiple ways] to tell Qt where to scan directories containing plugins. &amp;lt;code&amp;gt;addLibraryPath&amp;lt;/code&amp;gt; would probably be the easiest, but because plugins (e.g. designer) must be localized by Qt Designer when designing UIs, the solution is to have the environment variable &amp;lt;code&amp;gt;QT_PLUGIN_PATH&amp;lt;/code&amp;gt; set by the [[Documentation/{{documentation/version}}/Developers/Launcher|Slicer launcher]] (or using a ''qt.conf'' file when no launcher is available (e.g. MacOsX Slicer installs)).&lt;br /&gt;
A limitation of qt.conf is that it only handles 1 plugin path, this is why Slicer installs must have their plugins in a unique top directory. &lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
To create a plugin, use one of the macros in [https://github.com/commontk/CTK/blob/master/CMake/ctkMacroBuildQtPlugin.cmake ctkMacroBuildQtPlugin.cmake]:&lt;br /&gt;
*&amp;lt;code&amp;gt;ctkMacroBuildQtDesignerPlugin&amp;lt;/code&amp;gt; to build a Qt Designer plugin.&lt;br /&gt;
*&amp;lt;code&amp;gt;ctkMacroBuildQtIconEnginesPlugin&amp;lt;/code&amp;gt; to build an Icon Engine plugin.&lt;br /&gt;
*...&lt;br /&gt;
They are built in the ''bin/PLUGIN_TYPE'' directory where ''PLUGIN_TYPE'' is designer, imageformats... Only on Visual Studio they are also automatically in XXX-build/bin/PLUGIN_TYPE/BUILD_TYPE  where BUILD_TYPE is Debug, Release...&lt;br /&gt;
Refer to&lt;br /&gt;
&lt;br /&gt;
== Mac Bundle ==&lt;br /&gt;
Because Qt plugins are not ''direct'' dependency of Slicer (discovered and dynamically loaded at run time), Qt plugins need to be compiled as [http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_library MODULE] and need to be manually bundled at package time (see [http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Utilities/LastConfigureStep/SlicerCompleteBundles.cmake.in?view=markup SlicerCompleteBundles.cmake.in]). &lt;br /&gt;
&lt;br /&gt;
== Build ==&lt;br /&gt;
&amp;lt;code&amp;gt;QT_PLUGIN_PATH&amp;lt;/code&amp;gt; must points to 2 paths: ''Slicer-Superbuild/CTK-build/CTK-build/bin'' and &amp;lt;code&amp;gt;Slicer_QtPlugins_DIR&amp;lt;/code&amp;gt;=''Slicer-Superbuild/Slicer-build/bin''.&lt;br /&gt;
&lt;br /&gt;
The default Qt plugins (such as svg image format or sqldriver plugins) are in the Qtdir plugin path.  &lt;br /&gt;
&lt;br /&gt;
Plugins locations for Slicer builds: &lt;br /&gt;
* ''Slicer-Superbuild/CTK-build/CTK-build/bin/designer/CTK??????WidgetsPlugins.{so|dll}''&lt;br /&gt;
* ''Slicer-Superbuild/Slicer-build/bin/designer/qSlicer??????WidgetsPlugins.{so|dll}''&lt;br /&gt;
* ''Slicer-Superbuild/Slicer-build/bin/iconengines/qSlicer??????Plugin.{so|dll}''&lt;br /&gt;
* ''QtDir/plugins/imageformats/*.{so|dll|dylib}''&lt;br /&gt;
&lt;br /&gt;
On Windows, they also are in the following paths but are ignored by Qt:&lt;br /&gt;
* ''Slicer-Superbuild/CTK-build/CTK-build/bin/designer/Release/CTK??????WidgetsPlugins.{so|dll}''&lt;br /&gt;
* ''Slicer-Superbuild/Slicer-build/bin/designer/Release/qSlicer??????WidgetsPlugins.{so|dll}''&lt;br /&gt;
* ''Slicer-Superbuild/Slicer-build/bin/iconengines/Release/qSlicer??????Plugin.{so|dll}''&lt;br /&gt;
&lt;br /&gt;
See [[Documentation/{{documentation/version}}/Developers/DirectoryStructure#Build_tree|Build directory structure]]&lt;br /&gt;
&lt;br /&gt;
== Install ==&lt;br /&gt;
&amp;lt;code&amp;gt;QT_PLUGIN_PATH&amp;lt;/code&amp;gt; points to a unique path: &amp;lt;code&amp;gt;Slicer_INSTALL_QtPlugins_DIR&amp;lt;/code&amp;gt;=''Slicer/lib/QtPlugins''. However, on MacOSX, there is no launcher, so environment variables can't be set prior to launching Slicer. A ''qt.conf'' containing the ''Slicer/lib/QtPlugins'' path is used for the mac bundle. &lt;br /&gt;
In order for the plugins to be installed at the right location, &amp;lt;code&amp;gt;CTK_INSTALL_QTPLUGIN_DIR&amp;lt;/code&amp;gt; must be passed to CTK (see [http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/SuperBuild/External_CTK.cmake?view=markup External_CTK.cmake], this is internally used by ''ctkMacroBuildQtPlugin.cmake'')&lt;br /&gt;
Because Qt is packaged within Slicer, the plugins must also be packaged (see [http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/CMake/SlicerBlockInstallQtPlugins.cmake?view=markup SlicerBlockInstallQtPlugins.cmake])&lt;br /&gt;
Plugins locations for installed Slicer: &lt;br /&gt;
* Slicer/lib/QtPlugins/designer/CTK??????WidgetsPlugins.{so|dll}&lt;br /&gt;
* Slicer/lib/QtPlugins/iconengines/qSlicer??????WidgetsPlugins.{so|dll}&lt;br /&gt;
* Slicer/lib/QtPlugins/imageformats/*.{so|dll|dylib}&lt;br /&gt;
* Slicer/lib/QtPlugins/sqldrivers/*.{so|dll|dylib}&lt;br /&gt;
&lt;br /&gt;
See [[Documentation/{{documentation/version}}/Developers/DirectoryStructure#Install_tree|Install directory structure]]&lt;br /&gt;
&lt;br /&gt;
== Extensions ==&lt;br /&gt;
Extensions need to provide their plugin paths to the Slicer launcher.&lt;br /&gt;
{{documentation/underconstruction}}&lt;/div&gt;</summary>
		<author><name>UpdateBot</name></author>
		
	</entry>
</feed>