Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLMarkupsToolBar.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 ==============================================================================*/
17 
18 #ifndef __qMRMLMarkupsToolBar_h
19 #define __qMRMLMarkupsToolBar_h
20 
21 // Qt includes
22 #include <QSignalMapper>
23 #include <QToolBar>
24 #include <QMenu>
25 #include <QCheckBox>
26 
27 
28 // CTK includes
29 #include <ctkPimpl.h>
30 // no ui begin
31 #include <ctkVTKObject.h>
32 // no ui end
33 
34 // qMRMLWidget includes
35 #include "qMRMLWidget.h"
36 #include "qSlicerMarkupsModuleWidgetsExport.h"
37 
38 // MRML includes
39 #include <vtkMRMLScene.h>
40 
41 // MRML includes
42 #include <vtkSlicerMarkupsLogic.h>
43 
44 class qMRMLMarkupsToolBarPrivate;
45 class vtkMRMLNode;
46 class vtkMRMLScene;
47 class vtkMRMLMarkupsNode;
51 
52 class QAction;
53 class QActionGroup;
54 class QToolButton;
55 
56 class Q_SLICER_MODULE_MARKUPS_WIDGETS_EXPORT qMRMLMarkupsToolBar : public QToolBar
57 {
58  Q_OBJECT
59  QVTK_OBJECT
60 public:
61  typedef QToolBar Superclass;
62 
65  qMRMLMarkupsToolBar(const QString& title, QWidget* parent = 0);
66  qMRMLMarkupsToolBar(QWidget* parent = 0);
67  ~qMRMLMarkupsToolBar() override;
68 
69  vtkMRMLMarkupsNode* activeMarkupsNode();
70  Q_INVOKABLE vtkMRMLInteractionNode* interactionNode()const;
71  Q_INVOKABLE vtkMRMLSelectionNode* selectionNode()const;
72 
73  void initializeToolBarLayout();
74  void addCreateNodeShortcut(QString keySequence);
75  void addTogglePersistenceShortcut(QString keySequence);
76  void addPlacePointShortcut(QString keySequence);
77 
78 public slots:
79  void setApplicationLogic(vtkSlicerApplicationLogic* logic);
80  virtual void setMRMLScene(vtkMRMLScene* newScene);
81  void updateToolBarLayout();
82 
84  void setActiveMarkupsNode(vtkMRMLMarkupsNode* newActiveMarkupsNode);
85  void setPersistence(bool persistent);
86  void setInteractionNode(vtkMRMLInteractionNode* interactionNode);
87  void interactionModeActionTriggered(bool);
88  void setSelectionNode(vtkMRMLSelectionNode* selectionNode);
89 
91  void onAddNewMarkupsNodeByClass(const QString& className);
92  void onAddNewAnnotationNodeByClass(const QString& className);
93 
94  // Keyboard shortcuts for Markups node interactions
95  void onCreateNodeShortcut();
96  void onTogglePersistenceShortcut();
97  void onPlacePointShortcut();
98 
99 signals:
100  void mrmlSceneChanged(vtkMRMLScene*);
101  void activeMarkupsNodeChanged(vtkMRMLNode* activeMarkupsNode);
102  void activeMarkupsPlaceModeChanged(bool enabled);
103 
104 protected slots:
106  void onMarkupsNodeChanged(vtkMRMLNode*);
107 
108 protected:
109  QScopedPointer<qMRMLMarkupsToolBarPrivate> d_ptr;
110 
111 private:
112  Q_DECLARE_PRIVATE(qMRMLMarkupsToolBar);
113  Q_DISABLE_COPY(qMRMLMarkupsToolBar);
114 };
115 
116 #endif
QScopedPointer< qMRMLMarkupsToolBarPrivate > d_ptr
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
MRML node for storing information about the active nodes in the scene.