<?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.6%2FDevelopers%2FLayouts</id>
	<title>Documentation/4.6/Developers/Layouts - 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.6%2FDevelopers%2FLayouts"/>
	<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.6/Developers/Layouts&amp;action=history"/>
	<updated>2026-04-15T14:57:43Z</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.6/Developers/Layouts&amp;diff=47610&amp;oldid=prev</id>
		<title>UpdateBot: Nightly -&gt; 4.6</title>
		<link rel="alternate" type="text/html" href="https://www.slicer.org/w/index.php?title=Documentation/4.6/Developers/Layouts&amp;diff=47610&amp;oldid=prev"/>
		<updated>2016-11-07T07:01:24Z</updated>

		<summary type="html">&lt;p&gt;Nightly -&amp;gt; 4.6&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;
=Layout=&lt;br /&gt;
== Main classes ==&lt;br /&gt;
* [{{doxygen-class-url|vtkMRMLLayoutNode}}#details vtkMRMLLayoutNode]: Node that describes the layout of the views. There is only one layout node in the scene (singleton)&lt;br /&gt;
* [{{doxygen-class-url|vtkMRMLLayoutLogic}}#details vtkMRMLLayoutLogic]: Control/observe the layout node. Automatically create the view nodes if needed (referenced in the layout node description but not in the scene).  &lt;br /&gt;
* [{{doxygen-class-url|vtkMRMLAbstractViewNode}}#details vtkMRMLAbstractViewNode]: Abstract class for all the view nodes (such as [{{doxygen-class-url|vtkMRMLSliceNode}}#details vtkMRMLSliceNode], [{{doxygen-class-url|vtkMRMLViewNode}}#details vtkMRMLViewNode], [{{doxygen-class-url|vtkMRMLChartViewNode}}#details vtkMRMLChartViewNode]) that can be into a layout.&lt;br /&gt;
* &amp;lt;code&amp;gt;[http://www.commontk.org/docs/html/classctkLayoutManager.html ctkLayoutManager]&amp;lt;/code&amp;gt;: Mechanism to convert the layout description (xml) into a Qt layout with Qt widgets. &lt;br /&gt;
* [{{doxygen-class-url|qMRMLLayoutManager}}#details qMRMLLayoutManager]: Specialized version of ctkLayoutManager to handle MRML only views and properties.  &lt;br /&gt;
* [{{doxygen-class-url|qSlicerLayoutManager}}#details qSlicerLayoutManager]: Specialized version of qMRMLLayoutManager to handle Slicer specific behaviors. The Slicer layout manager is accessible from the [{{doxygen-class-url|qSlicerApplication}}#details qSlicerApplication] singleton.&lt;br /&gt;
&lt;br /&gt;
==Layout mechanism==&lt;br /&gt;
&lt;br /&gt;
==How to change the layout ?==&lt;br /&gt;
&lt;br /&gt;
==How to register a new layout ?==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  qMRMLLayoutSliceViewFactory* mrmlSliceViewFactory =&lt;br /&gt;
    qobject_cast&amp;lt;qMRMLLayoutSliceViewFactory*&amp;gt;(&lt;br /&gt;
    d-&amp;gt;app-&amp;gt;layoutManager()-&amp;gt;mrmlViewFactory(&amp;quot;vtkMRMLSliceNode&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
  qSlicerCustomLayoutSliceViewFactory* customSliceViewFactory =&lt;br /&gt;
    new qSlicerCustomLayoutSliceViewFactory(d-&amp;gt;app-&amp;gt;layoutManager());&lt;br /&gt;
  customSliceViewFactory-&amp;gt;setSliceLogics(mrmlSliceViewFactory-&amp;gt;sliceLogics());&lt;br /&gt;
&lt;br /&gt;
  d-&amp;gt;app-&amp;gt;layoutManager()-&amp;gt;unregisterViewFactory(mrmlSliceViewFactory);&lt;br /&gt;
  d-&amp;gt;app-&amp;gt;layoutManager()-&amp;gt;registerViewFactory(customSliceViewFactory);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== View XML elements ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vtkMRMLLayoutNode* layoutNode =  vtkMRMLLayoutNode::SafeDownCast(&lt;br /&gt;
    this-&amp;gt;mrmlScene()-&amp;gt;GetSingletonNode(&amp;quot;vtkMRMLLayoutNode&amp;quot;,&amp;quot;vtkMRMLLayoutNode&amp;quot;));&lt;br /&gt;
std::string layoutDescription = layoutNode-&amp;gt;GetLayoutDescription(index);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Layout descriptions can be modified using the SetLayoutDescription method&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Example of qSlicerCustomLayoutSliceViewFactory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ifndef __qSlicerAstroVolumeLayoutSliceViewFactory_h&lt;br /&gt;
#define __qSlicerAstroVolumeLayoutSliceViewFactory_h&lt;br /&gt;
&lt;br /&gt;
// SlicerQt includes&lt;br /&gt;
#include &amp;quot;qMRMLLayoutManager.h&amp;quot;&lt;br /&gt;
#include &amp;quot;qMRMLLayoutManager_p.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// VTK includes&lt;br /&gt;
#include &amp;lt;vtkWeakPointer.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;qSlicerAstroVolumeModuleExport.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class qSlicerAstroVolumeLayoutSliceViewFactoryPrivate;&lt;br /&gt;
&lt;br /&gt;
/// \ingroup Slicer_QtModules_AstroVolume&lt;br /&gt;
class Q_SLICER_QTMODULES_ASTROVOLUME_EXPORT qSlicerAstroVolumeLayoutSliceViewFactory&lt;br /&gt;
 : public qMRMLLayoutSliceViewFactory&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
  typedef qMRMLLayoutSliceViewFactory Superclass;&lt;br /&gt;
  qSlicerAstroVolumeLayoutSliceViewFactory(QObject* parent);&lt;br /&gt;
  virtual ~qSlicerAstroVolumeLayoutSliceViewFactory();&lt;br /&gt;
&lt;br /&gt;
  virtual QString viewClassName()const;&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
&lt;br /&gt;
  virtual QWidget* createViewFromNode(vtkMRMLAbstractViewNode* viewNode);&lt;br /&gt;
  virtual void deleteView(vtkMRMLAbstractViewNode* viewNode);&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  Q_DECLARE_PRIVATE(qSlicerAstroVolumeLayoutSliceViewFactory);&lt;br /&gt;
  Q_DISABLE_COPY(qSlicerAstroVolumeLayoutSliceViewFactory);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
qSlicerAstroVolumeLayoutSliceViewFactory::qSlicerAstroVolumeLayoutSliceViewFactory(QObject* _parent)&lt;br /&gt;
  : Superclass(_parent)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
qSlicerAstroVolumeLayoutSliceViewFactory::~qSlicerAstroVolumeLayoutSliceViewFactory()&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
QWidget* qSlicerAstroVolumeLayoutSliceViewFactory::createViewFromNode(vtkMRMLAbstractViewNode* viewNode)&lt;br /&gt;
{&lt;br /&gt;
  if (!this-&amp;gt;layoutManager() || !viewNode)&lt;br /&gt;
    {// can't create a slice widget if there is no parent widget&lt;br /&gt;
    Q_ASSERT(viewNode);&lt;br /&gt;
    return 0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  // there is a unique slice widget per node&lt;br /&gt;
  Q_ASSERT(!this-&amp;gt;viewWidget(viewNode));&lt;br /&gt;
&lt;br /&gt;
  qMRMLSliceAstroWidget * sliceWidget = new qMRMLSliceAstroWidget(this-&amp;gt;layoutManager()-&amp;gt;viewport());&lt;br /&gt;
  sliceWidget-&amp;gt;sliceController()-&amp;gt;setControllerButtonGroup(this-&amp;gt;SliceControllerButtonGroup);&lt;br /&gt;
  QString sliceLayoutName(viewNode-&amp;gt;GetLayoutName());&lt;br /&gt;
  QString sliceViewLabel(viewNode-&amp;gt;GetLayoutLabel());&lt;br /&gt;
  vtkMRMLSliceNode* sliceNode = vtkMRMLSliceNode::SafeDownCast(viewNode);&lt;br /&gt;
  QColor sliceLayoutColor = QColor::fromRgbF(sliceNode-&amp;gt;GetLayoutColor()[0],&lt;br /&gt;
                                             sliceNode-&amp;gt;GetLayoutColor()[1],&lt;br /&gt;
                                             sliceNode-&amp;gt;GetLayoutColor()[2]);&lt;br /&gt;
  sliceWidget-&amp;gt;setSliceViewName(sliceLayoutName);&lt;br /&gt;
  sliceWidget-&amp;gt;setObjectName(QString(&amp;quot;qMRMLSliceWidget&amp;quot; + sliceLayoutName));&lt;br /&gt;
  sliceWidget-&amp;gt;setSliceViewLabel(sliceViewLabel);&lt;br /&gt;
  sliceWidget-&amp;gt;setSliceViewColor(sliceLayoutColor);&lt;br /&gt;
  sliceWidget-&amp;gt;setMRMLScene(this-&amp;gt;mrmlScene());&lt;br /&gt;
  sliceWidget-&amp;gt;setMRMLSliceNode(sliceNode);&lt;br /&gt;
  sliceWidget-&amp;gt;setSliceLogics(this-&amp;gt;sliceLogics());&lt;br /&gt;
&lt;br /&gt;
  this-&amp;gt;sliceLogics()-&amp;gt;AddItem(sliceWidget-&amp;gt;sliceLogic());&lt;br /&gt;
&lt;br /&gt;
  return sliceWidget;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void qSlicerAstroVolumeLayoutSliceViewFactory::deleteView(vtkMRMLAbstractViewNode *viewNode)&lt;br /&gt;
{&lt;br /&gt;
  qMRMLSliceAstroWidget* sliceWidget =&lt;br /&gt;
    qobject_cast&amp;lt;qMRMLSliceAstroWidget*&amp;gt;(this-&amp;gt;viewWidget(viewNode));&lt;br /&gt;
  if (sliceWidget)&lt;br /&gt;
    {&lt;br /&gt;
    this-&amp;gt;sliceLogics()-&amp;gt;RemoveItem(sliceWidget-&amp;gt;sliceLogic());&lt;br /&gt;
    }&lt;br /&gt;
  this-&amp;gt;Superclass::deleteView(viewNode);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
QString qSlicerAstroVolumeLayoutSliceViewFactory::viewClassName() const&lt;br /&gt;
{&lt;br /&gt;
  return &amp;quot;vtkMRMLSliceNode&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>UpdateBot</name></author>
		
	</entry>
</feed>