Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLTransformItemDelegate.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6  Queen's University, Kingston, ON, Canada. All Rights Reserved.
7 
8  See COPYRIGHT.txt
9  or http://www.slicer.org/copyright/copyright.txt for details.
10 
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16 
17  This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18  and was supported through the Applied Cancer Research Unit program of Cancer Care
19  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20 
21 ==============================================================================*/
22 
23 #ifndef __qMRMLTransformItemDelegate_h
24 #define __qMRMLTransformItemDelegate_h
25 
26 // Qt includes
27 #include <QStyledItemDelegate>
28 
29 // SubjectHierarchy includes
30 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h"
31 
32 class vtkMRMLScene;
33 
35 class Q_SLICER_MODULE_SUBJECTHIERARCHY_WIDGETS_EXPORT qMRMLTransformItemDelegate: public QStyledItemDelegate
36 {
37  Q_OBJECT
38 public:
39  qMRMLTransformItemDelegate(QObject *parent = 0);
40  virtual ~qMRMLTransformItemDelegate();
41 
42  void setMRMLScene(vtkMRMLScene* scene);
43 
45  bool isTransform(const QModelIndex& index)const;
46 
47  virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
48  const QModelIndex &index) const;
49 
50  virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
51  virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
52  const QModelIndex &index) const;
53 
54  virtual QSize sizeHint(const QStyleOptionViewItem &option,
55  const QModelIndex &index) const;
56 
57  void updateEditorGeometry(QWidget *editor,
58  const QStyleOptionViewItem &option, const QModelIndex &index) const;
59 
60  virtual bool eventFilter(QObject *object, QEvent *event);
61 
65  void setFixedRowHeight(int height);
66 
67  // We make initStyleOption public so it can be used by the tree view
68  using QStyledItemDelegate::initStyleOption;
69 
70 signals:
71  void removeTransformsFromBranchOfCurrentItem();
72  void hardenTransformOnBranchOfCurrentItem();
73 
74 protected slots:
75  void commitAndClose();
76 
77 protected:
80  QAction* HardenAction;
82 };
83 
84 #endif
Item Delegate for MRML parent transform property.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54