Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkPropertyItemModel.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 QmitkPropertyItemModel_h
18 #define QmitkPropertyItemModel_h
19 
20 #include <MitkQtWidgetsExports.h>
21 #include <QAbstractItemModel>
22 #include <mitkPropertyList.h>
23 #include <mitkWeakPointer.h>
24 
25 class QmitkPropertyItem;
26 
27 namespace berry
28 {
29  struct IBerryPreferences;
30 }
31 
32 namespace mitk
33 {
34  class IPropertyAliases;
35  class IPropertyFilters;
36 
37  enum
38  {
39  PropertyRole = Qt::UserRole + 1
40  };
41 }
42 
43 class MITKQTWIDGETS_EXPORT QmitkPropertyItemModel : public QAbstractItemModel
44 {
45  Q_OBJECT
46 
47 public:
48  explicit QmitkPropertyItemModel(QObject *parent = NULL);
50 
51  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
52  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
53  Qt::ItemFlags flags(const QModelIndex &index) const override;
54  mitk::PropertyList *GetPropertyList() const;
55  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
56  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
57  void OnPreferencesChanged();
58  QModelIndex parent(const QModelIndex &child) const override;
59  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
60  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
61  void SetPropertyList(mitk::PropertyList *propertyList, const QString &className = "");
62  void Update();
63 
64  void SetShowAliases(const bool showAliases) { this->m_ShowAliases = showAliases; }
65  bool GetShowAliases() const { return this->m_ShowAliases; }
66  void SetFilterProperties(const bool filterProperties) { this->m_FilterProperties = filterProperties; }
67  bool GetFilterProperties() const { return this->m_FilterProperties; }
68 private:
69  void CreateRootItem();
70  QModelIndex FindProperty(const mitk::BaseProperty *property);
71  void OnPropertyDeleted(const itk::Object *property, const itk::EventObject &event);
72  void OnPropertyListDeleted(const itk::Object *propertyList);
73  void OnPropertyModified(const itk::Object *property, const itk::EventObject &event);
74  void SetNewPropertyList(mitk::PropertyList *propertyList);
75 
76  bool m_ShowAliases;
77  bool m_FilterProperties;
78  mitk::IPropertyAliases *m_PropertyAliases;
79  mitk::IPropertyFilters *m_PropertyFilters;
81  QString m_ClassName;
82  std::unique_ptr<QmitkPropertyItem> m_RootItem;
83  std::map<std::string, unsigned long> m_PropertyDeletedTags;
84  std::map<std::string, unsigned long> m_PropertyModifiedTags;
85 };
86 
87 #endif
Interface of property aliases service.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKQTWIDGETS_EXPORT
Key-value list holding instances of BaseProperty.
Abstract base class for properties.
void SetFilterProperties(const bool filterProperties)
void SetShowAliases(const bool showAliases)
Interface of property filters service.