Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkNDIToolDelegate.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QmitkNDIToolDelegate_h
18 #define QmitkNDIToolDelegate_h
19 
21 #include "MitkIGTUIExports.h"
22 #include "mitkNodePredicateBase.h"
23 #include "mitkBaseProperty.h"
25 #include <QStyledItemDelegate>
26 
28 namespace mitk
29 {
30  class DataStorage;
31  class NodePredicateBase;
32  class BaseProperty;
33 };
34 
39 class MITKIGTUI_EXPORT QmitkNDIToolDelegate : public QStyledItemDelegate
40 {
41  Q_OBJECT
42 
43  public:
47  QmitkNDIToolDelegate(QObject *parent = nullptr);
48 
50  {
51  IndexCol = 0,
57  RepCol
58  };
60  {
61  NDIToolRole = 70,
65  TypeRole
66  };
67 
68 
69  void SetTypes(const QStringList& types);
70  void SetDataStorage(mitk::DataStorage* ds);
71  void SetPredicate(mitk::NodePredicateBase::Pointer p);
72  void SetTagPropertyName(const std::string& name);
73  void SetTagProperty(mitk::BaseProperty::Pointer prop);
74 
78  //void paint(QPainter *painter, const QStyleOptionViewItem &option
79  // , const QModelIndex &index) const;
80 
84  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option
85  , const QModelIndex &index) const override;
86 
90  void setEditorData(QWidget *editor, const QModelIndex &index) const override;
91 
95  void setModelData(QWidget *editor, QAbstractItemModel* model
96  , const QModelIndex &index) const override;
97 
101  //void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
102 
103  private slots:
107  void commitAndCloseEditor();
108  void ComboBoxCurrentIndexChanged ( int index ) ;
109 
110 
111 private:
112  QStringList m_Types;
115  mitk::BaseProperty::Pointer m_TagProperty;
116  std::string m_TagPropertyName;
117 };
118 #endif /* QmitkNDIToolDelegate_h */
Data management class that handles 'was created by' relations.
DataCollection - Class to facilitate loading/accessing structured data.
An item delegate for rendering and editing mitk::Properties in a QTableView.
mitk::DataStorage::Pointer m_DataStorage