Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLLayoutViewFactory.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 __qMRMLLayoutViewFactory_h
22 #define __qMRMLLayoutViewFactory_h
23 
24 // Qt includes
25 #include <QStringList>
26 
27 // CTK includes
28 #include <ctkLayoutViewFactory.h>
29 #include <ctkVTKObject.h>
30 
31 // MRML includes
32 #include "qMRMLWidgetsExport.h"
33 class qMRMLLayoutManager;
34 class qMRMLLayoutViewFactoryPrivate;
36 class vtkMRMLNode;
37 class vtkMRMLScene;
38 
39 // VTK includes
40 class vtkCollection;
41 class vtkObject;
42 class vtkRenderer;
43 
44 class QMRML_WIDGETS_EXPORT qMRMLLayoutViewFactory : public ctkLayoutViewFactory
45 {
46  Q_OBJECT
47  QVTK_OBJECT
52  Q_PROPERTY(QString viewClassName READ viewClassName);
53 public:
55  typedef ctkLayoutViewFactory Superclass;
56 
58  explicit qMRMLLayoutViewFactory(QObject* parent=nullptr);
59  ~qMRMLLayoutViewFactory() override;
60 
65  virtual QString viewClassName()const;
66 
69  bool isElementSupported(QDomElement layoutElement)const override;
70 
73  virtual bool isViewNodeSupported(vtkMRMLAbstractViewNode* viewNode)const;
74 
78  Q_INVOKABLE qMRMLLayoutManager* layoutManager()const;
79 
82  Q_INVOKABLE void setLayoutManager(qMRMLLayoutManager*);
83 
86  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
87 
88  Q_INVOKABLE QWidget* viewWidget(int id)const;
89  Q_INVOKABLE QWidget* viewWidget(vtkMRMLAbstractViewNode* node)const;
90  Q_INVOKABLE QWidget* viewWidget(const QString& name)const;
91  Q_INVOKABLE QWidget* viewWidgetByLayoutLabel(const QString& layoutLabel)const;
92  Q_INVOKABLE int viewCount()const;
93 
94  void beginSetupLayout() override;
95 
96  vtkMRMLAbstractViewNode* viewNode(QWidget* widget)const;
97 
99  QStringList viewNodeNames() const;
100 
101  void setActiveViewNode(vtkMRMLAbstractViewNode* viewNode);
102  vtkMRMLAbstractViewNode* activeViewNode()const;
103  virtual vtkRenderer* activeRenderer()const;
104 
105 public Q_SLOTS:
110  virtual void setMRMLScene(vtkMRMLScene* scene);
111 
112  virtual void onNodeAdded(vtkObject* scene, vtkObject* node);
113  virtual void onNodeRemoved(vtkObject* scene, vtkObject* node);
114  virtual void onNodeModified(vtkObject* node);
115  virtual void onViewNodeAdded(vtkMRMLAbstractViewNode* node);
116  virtual void onViewNodeRemoved(vtkMRMLAbstractViewNode* node);
117  virtual void onViewNodeModified(vtkMRMLAbstractViewNode* node);
118 
121  virtual void onSceneModified();
122 
123 Q_SIGNALS:
125  void viewCreated(QWidget* createdView);
126 
129  void activeViewNodeChanged(vtkMRMLAbstractViewNode*);
130 
131 
132 protected:
133  QScopedPointer<qMRMLLayoutViewFactoryPrivate> d_ptr;
134 
135  void setupView(QDomElement viewElement, QWidget* view) override;
138  QWidget* createViewFromXML(QDomElement layoutElement) override;
140  QList<QWidget*> createViewsFromXML(QDomElement layoutElement) override;
141 
142  virtual vtkMRMLAbstractViewNode* viewNodeFromXML(QDomElement viewElement)const;
143  virtual QList<vtkMRMLAbstractViewNode*> viewNodesFromXML(QDomElement viewElement)const;
144 
148  virtual QWidget* createViewFromNode(vtkMRMLAbstractViewNode* node);
149  virtual void deleteView(vtkMRMLAbstractViewNode* node);
150 
151 private:
152  Q_DECLARE_PRIVATE(qMRMLLayoutViewFactory);
153  Q_DISABLE_COPY(qMRMLLayoutViewFactory);
154 };
155 
156 #endif
ctkLayoutViewFactory Superclass
Superclass typedef.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
QScopedPointer< qMRMLLayoutViewFactoryPrivate > d_ptr
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167