Slicer 5.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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"
34
35class qMRMLPlotWidget;
39class qMRMLLayoutManagerPrivate;
41
45class vtkMRMLScene;
46class vtkMRMLNode;
49class vtkMRMLViewNode;
51
52class vtkCollection;
53class vtkRenderer;
54
74class QMRML_WIDGETS_EXPORT qMRMLLayoutManager : public ctkLayoutFactory
75{
76 Q_OBJECT
77
84 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
85 // The following properties are exposed so that they are available within python
86 Q_PROPERTY(int layout READ layout WRITE setLayout NOTIFY layoutChanged DESIGNABLE false)
87 Q_PROPERTY(int threeDViewCount READ threeDViewCount DESIGNABLE false)
88 Q_PROPERTY(int tableViewCount READ tableViewCount DESIGNABLE false)
89 Q_PROPERTY(int plotViewCount READ plotViewCount DESIGNABLE false)
90
91public:
93 typedef ctkLayoutFactory Superclass;
94
96 explicit qMRMLLayoutManager(QObject* parent = nullptr);
97 explicit qMRMLLayoutManager(QWidget* viewport, QObject* parent);
98 ~qMRMLLayoutManager() override;
99
102 bool isEnabled() const;
103
108 Q_INVOKABLE virtual void registerViewFactory(ctkLayoutViewFactory* viewFactory);
109
114
118 Q_INVOKABLE qMRMLLayoutViewFactory* mrmlViewFactory(const QString& viewClassName) const;
119
123 Q_INVOKABLE vtkMRMLScene* mrmlScene() const;
124
128 Q_INVOKABLE QWidget* viewWidget(vtkMRMLNode* n) const;
129
131 Q_INVOKABLE QList<QWidget*> viewWidgets() const;
132
134 Q_INVOKABLE qMRMLSliceWidget* sliceWidget(const QString& name) const;
135
137 Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(const QString& name) const;
138
142 Q_INVOKABLE QStringList sliceViewNames() const;
143
145 int threeDViewCount() const;
147 int tableViewCount() const;
149 int plotViewCount() const;
151 int viewCount() const;
152
157 Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(int id) const;
158 Q_INVOKABLE qMRMLTableWidget* tableWidget(int id) const;
159 Q_INVOKABLE qMRMLPlotWidget* plotWidget(int id) const;
160
163 Q_INVOKABLE vtkCollection* mrmlSliceLogics() const;
164
167 Q_INVOKABLE vtkCollection* mrmlViewLogics() const;
168
169 Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
170 Q_INVOKABLE vtkMRMLColorLogic* mrmlColorLogic() const;
171
175 int layout() const;
176
179 Q_INVOKABLE vtkMRMLLayoutLogic* layoutLogic() const;
180
190 Q_INVOKABLE vtkRenderer* activeThreeDRenderer() const;
200 Q_INVOKABLE vtkRenderer* activeTableRenderer() const;
210 Q_INVOKABLE vtkRenderer* activePlotRenderer() const;
211
217
218public slots:
221 void setEnabled(bool enable);
222
226
229 void setLayout(int newLayout);
230
234
237
240
245
249
253
258 void setRenderPaused(bool pause);
259
263
267
268signals:
269 void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode* newActiveMRMLThreeDViewNode);
270 void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode* newActiveMRMLTableViewNode);
271 void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode* newActiveMRMLPlotViewNode);
272 void activeThreeDRendererChanged(vtkRenderer* newRenderer);
273 void activeTableRendererChanged(vtkRenderer* newRenderer);
274 void activePlotRendererChanged(vtkRenderer* newRenderer);
275 void layoutChanged(int);
276
279
280protected:
281 QScopedPointer<qMRMLLayoutManagerPrivate> d_ptr;
282 qMRMLLayoutManager(qMRMLLayoutManagerPrivate* obj, QWidget* viewport, QObject* parent);
283
284 QWidget* createViewport(const QDomElement& layoutElement, const QString& viewportName) override;
285 void onViewportChanged() override;
286 void onViewportUsageChanged(const QString& viewportName) override;
287
288 using ctkLayoutManager::setLayout;
289
290private:
291 Q_DECLARE_PRIVATE(qMRMLLayoutManager);
292 Q_DISABLE_COPY(qMRMLLayoutManager);
293};
294
295#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.