Difference between revisions of "Documentation/Nightly/Developers/Layouts"
From Slicer Wiki
Line 14: | Line 14: | ||
==How to register a new layout ?== | ==How to register a new layout ?== | ||
+ | |||
+ | |||
+ | <pre> | ||
+ | qMRMLLayoutSliceViewFactory* mrmlSliceViewFactory = | ||
+ | qobject_cast<qMRMLLayoutSliceViewFactory*>( | ||
+ | d->app->layoutManager()->mrmlViewFactory("vtkMRMLSliceNode")); | ||
+ | |||
+ | qSlicerCustomLayoutSliceViewFactory* customSliceViewFactory = | ||
+ | new qSlicerCustomLayoutSliceViewFactory(d->app->layoutManager()); | ||
+ | customSliceViewFactory->setSliceLogics(mrmlSliceViewFactory->sliceLogics()); | ||
+ | |||
+ | d->app->layoutManager()->unregisterViewFactory(mrmlSliceViewFactory); | ||
+ | d->app->layoutManager()->registerViewFactory(customSliceViewFactory); | ||
+ | </pre> | ||
== View XML elements == | == View XML elements == | ||
== Example == | == Example == |
Revision as of 19:58, 8 June 2016
Home < Documentation < Nightly < Developers < Layouts
For the latest Slicer documentation, visit the read-the-docs. |
Contents
Layout
Main classes
- vtkMRMLLayoutNode: Node that describes the layout of the views. There is only one layout node in the scene (singleton)
- vtkMRMLLayoutLogic: Control/observe the layout node. Automatically create the view nodes if needed (referenced in the layout node description but not in the scene).
- vtkMRMLAbstractViewNode: Abstract class for all the view nodes (such as vtkMRMLSliceNode, vtkMRMLViewNode, vtkMRMLChartViewNode) that can be into a layout.
ctkLayoutManager
: Mechanism to convert the layout description (xml) into a Qt layout with Qt widgets.- qMRMLLayoutManager: Specialized version of ctkLayoutManager to handle MRML only views and properties.
- qSlicerLayoutManager: Specialized version of qMRMLLayoutManager to handle Slicer specific behaviors. The Slicer layout manager is accessible from the qSlicerApplication singleton.
Layout mechanism
How to change the layout ?
How to register a new layout ?
qMRMLLayoutSliceViewFactory* mrmlSliceViewFactory = qobject_cast<qMRMLLayoutSliceViewFactory*>( d->app->layoutManager()->mrmlViewFactory("vtkMRMLSliceNode")); qSlicerCustomLayoutSliceViewFactory* customSliceViewFactory = new qSlicerCustomLayoutSliceViewFactory(d->app->layoutManager()); customSliceViewFactory->setSliceLogics(mrmlSliceViewFactory->sliceLogics()); d->app->layoutManager()->unregisterViewFactory(mrmlSliceViewFactory); d->app->layoutManager()->registerViewFactory(customSliceViewFactory);