Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qMRMLLayoutManager.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Julien Finet, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __qMRMLLayoutManager_h
22#define __qMRMLLayoutManager_h
23
24// Qt includes
25#include <QStringList>
26class QWidget;
27
28// CTK includes
29#include <ctkLayoutFactory.h>
30
31// qMRML includes
32#include "qMRMLWidgetsExport.h"
33
34class qMRMLPlotWidget;
38class qMRMLLayoutManagerPrivate;
40
44class vtkMRMLScene;
45class vtkMRMLNode;
48class vtkMRMLViewNode;
50
51class vtkCollection;
52class vtkRenderer;
53
73class QMRML_WIDGETS_EXPORT qMRMLLayoutManager : public ctkLayoutFactory
74{
75 Q_OBJECT
76
83 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
84 // The following properties are exposed so that they are available within python
85 Q_PROPERTY(int layout READ layout WRITE setLayout NOTIFY layoutChanged DESIGNABLE false)
86 Q_PROPERTY(int threeDViewCount READ threeDViewCount DESIGNABLE false)
87 Q_PROPERTY(int tableViewCount READ tableViewCount DESIGNABLE false)
88 Q_PROPERTY(int plotViewCount READ plotViewCount DESIGNABLE false)
89
90public:
92 typedef ctkLayoutFactory Superclass;
93
95 explicit qMRMLLayoutManager(QObject* parent=nullptr);
96 explicit qMRMLLayoutManager(QWidget* viewport, QObject* parent);
97 ~qMRMLLayoutManager() override;
98
101 bool isEnabled()const;
102
107 Q_INVOKABLE virtual void registerViewFactory(ctkLayoutViewFactory* viewFactory);
108
113
117 Q_INVOKABLE qMRMLLayoutViewFactory* mrmlViewFactory(const QString& viewClassName)const;
118
122 Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
123
127 Q_INVOKABLE QWidget* viewWidget(vtkMRMLNode* n) const;
128
130 Q_INVOKABLE QList<QWidget*> viewWidgets() const;
131
133 Q_INVOKABLE qMRMLSliceWidget* sliceWidget(const QString& name)const;
134
136 Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(const QString& name)const;
137
141 Q_INVOKABLE QStringList sliceViewNames() const;
142
144 int threeDViewCount()const;
146 int tableViewCount()const;
148 int plotViewCount()const;
150 int viewCount() const;
151
156 Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(int id)const;
157 Q_INVOKABLE qMRMLTableWidget* tableWidget(int id)const;
158 Q_INVOKABLE qMRMLPlotWidget* plotWidget(int id)const;
159
162 Q_INVOKABLE vtkCollection* mrmlSliceLogics()const;
163
166 Q_INVOKABLE vtkCollection* mrmlViewLogics()const;
167
168 Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
170
174 int layout()const;
175
178 Q_INVOKABLE vtkMRMLLayoutLogic* layoutLogic()const;
179
189 Q_INVOKABLE vtkRenderer* activeThreeDRenderer()const;
199 Q_INVOKABLE vtkRenderer* activeTableRenderer()const;
209 Q_INVOKABLE vtkRenderer* activePlotRenderer()const;
210
216
217public slots:
220 void setEnabled(bool enable);
221
225
228 void setLayout(int newLayout);
229
233
236
239
244
248
252
257 void setRenderPaused(bool pause);
258
262
266
267signals:
268 void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode* newActiveMRMLThreeDViewNode);
269 void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode* newActiveMRMLTableViewNode);
270 void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode* newActiveMRMLPlotViewNode);
271 void activeThreeDRendererChanged(vtkRenderer* newRenderer);
272 void activeTableRendererChanged(vtkRenderer* newRenderer);
273 void activePlotRendererChanged(vtkRenderer* newRenderer);
274 void layoutChanged(int);
275
278
279protected:
280 QScopedPointer<qMRMLLayoutManagerPrivate> d_ptr;
281 qMRMLLayoutManager(qMRMLLayoutManagerPrivate* obj, QWidget* viewport, QObject* parent);
282
283 QWidget* createViewport(const QDomElement& layoutElement, const QString& viewportName) override;
284 void onViewportChanged() override;
285 void onViewportUsageChanged(const QString& viewportName) override;
286
287 using ctkLayoutManager::setLayout;
288private:
289 Q_DECLARE_PRIVATE(qMRMLLayoutManager);
290 Q_DISABLE_COPY(qMRMLLayoutManager);
291};
292
293#endif
Q_INVOKABLE qMRMLSliceWidget * sliceWidget(const QString &name) const
Get slice view widget identified by name.
void activeThreeDRendererChanged(vtkRenderer *newRenderer)
void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode *newActiveMRMLThreeDViewNode)
Q_INVOKABLE vtkRenderer * activeThreeDRenderer() const
void activeTableRendererChanged(vtkRenderer *newRenderer)
void setRenderPaused(bool pause)
Q_INVOKABLE vtkRenderer * activeTableRenderer() const
void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode *newActiveMRMLPlotViewNode)
void onViewportUsageChanged(const QString &viewportName) override
Q_INVOKABLE vtkMRMLTableViewNode * activeMRMLTableViewNode() const
Q_INVOKABLE qMRMLTableWidget * tableWidget(int id) const
Q_INVOKABLE QList< QWidget * > viewWidgets() const
Get a list of all QWidgets for all views in the layout manager.
int allViewsPauseRenderCount()
Q_INVOKABLE QList< qMRMLLayoutViewFactory * > mrmlViewFactories() const
Q_INVOKABLE vtkCollection * mrmlSliceLogics() const
Q_INVOKABLE QStringList sliceViewNames() const
void removeMaximizedViewNode(vtkMRMLAbstractViewNode *viewNode)
Restores the original (non-maximized) layout of the viewport.
Q_INVOKABLE qMRMLPlotWidget * plotWidget(int id) const
qMRMLLayoutManager(QObject *parent=nullptr)
Constructors.
void removeAllMaximizedViewNodes()
Restore original (non-maximized) view layouts in all viewports.
void setLayout(int newLayout)
bool isEnabled() const
Q_INVOKABLE vtkCollection * mrmlViewLogics() const
void addMaximizedViewNode(vtkMRMLAbstractViewNode *viewNode)
Q_INVOKABLE vtkMRMLColorLogic * mrmlColorLogic() const
Q_INVOKABLE qMRMLLayoutViewFactory * mrmlViewFactory(const QString &viewClassName) const
void setMRMLScene(vtkMRMLScene *scene)
void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode *newActiveMRMLTableViewNode)
void activePlotRendererChanged(vtkRenderer *newRenderer)
void setLayoutNumberOfCompareViewColumns(int num)
Q_INVOKABLE qMRMLThreeDWidget * threeDWidget(const QString &name) const
Get 3D widget identified by name.
void layoutChanged(int)
Q_INVOKABLE QWidget * viewWidget(vtkMRMLNode *n) const
int viewCount() const
Return the total number of views.
Q_INVOKABLE vtkRenderer * activePlotRenderer() const
void setLayoutNumberOfCompareViewRows(int num)
Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic *colorLogic)
Q_INVOKABLE vtkMRMLPlotViewNode * activeMRMLPlotViewNode() const
void onViewportChanged() override
void setEnabled(bool enable)
QWidget * createViewport(const QDomElement &layoutElement, const QString &viewportName) override
ctkLayoutFactory Superclass
Superclass typedef.
Q_INVOKABLE vtkMRMLLayoutLogic * layoutLogic() const
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
QScopedPointer< qMRMLLayoutManagerPrivate > d_ptr
void nodeAboutToBeEdited(vtkMRMLNode *node)
Signal emitted when editing of a node is requested from within the layout.
virtual Q_INVOKABLE void registerViewFactory(ctkLayoutViewFactory *viewFactory)
Q_INVOKABLE vtkMRMLViewNode * activeMRMLThreeDViewNode() const
qMRMLPlotWidget is the top-level Plotting widget that can be packed in a layout.
qMRMLTableWidget is the top-level table widget that can be packed in a layout.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
MRML logic class for color manipulation.
MRML logic class for layout manipulation.
Abstract Superclass for all specific types of MRML nodes.
MRML node to represent Plot view parameters.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node to represent a table object.
MRML node to represent table view parameters.
MRML node to represent a 3D view.