Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkPropertyItemModel_h
14 #define QmitkPropertyItemModel_h
15 
16 #include <MitkQtWidgetsExports.h>
17 #include <QAbstractItemModel>
18 #include <mitkPropertyList.h>
19 #include <mitkWeakPointer.h>
20 
21 class QmitkPropertyItem;
22 
23 namespace berry
24 {
25  struct IBerryPreferences;
26 }
27 
28 namespace mitk
29 {
30  class IPropertyAliases;
31  class IPropertyFilters;
32 
33  enum
34  {
35  PropertyRole = Qt::UserRole + 1
36  };
37 }
38 
39 class MITKQTWIDGETS_EXPORT QmitkPropertyItemModel : public QAbstractItemModel
40 {
41  Q_OBJECT
42 
43 public:
44  explicit QmitkPropertyItemModel(QObject *parent = nullptr);
45  ~QmitkPropertyItemModel() override;
46 
47  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
48  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
49  Qt::ItemFlags flags(const QModelIndex &index) const override;
50  mitk::PropertyList *GetPropertyList() const;
51  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
52  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
53  void OnPreferencesChanged();
54  QModelIndex parent(const QModelIndex &child) const override;
55  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
56  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
57  void SetPropertyList(mitk::PropertyList *propertyList, const QString &className = "");
58  void Update();
59 
60  void SetShowAliases(const bool showAliases) { this->m_ShowAliases = showAliases; }
61  bool GetShowAliases() const { return this->m_ShowAliases; }
62  void SetFilterProperties(const bool filterProperties) { this->m_FilterProperties = filterProperties; }
63  bool GetFilterProperties() const { return this->m_FilterProperties; }
64 private:
65  void CreateRootItem();
66  QModelIndex FindProperty(const mitk::BaseProperty *property);
67  void OnPropertyListModified();
68  void OnPropertyListDeleted();
69  void OnPropertyModified(const itk::Object *property, const itk::EventObject &event);
70  void SetNewPropertyList(mitk::PropertyList *newPropertyList);
71 
72  bool m_ShowAliases;
73  bool m_FilterProperties;
74  mitk::IPropertyAliases *m_PropertyAliases;
75  mitk::IPropertyFilters *m_PropertyFilters;
77  QString m_ClassName;
78  std::unique_ptr<QmitkPropertyItem> m_RootItem;
79  std::map<std::string, unsigned long> m_PropertyDeletedTags;
80  std::map<std::string, unsigned long> m_PropertyModifiedTags;
81  unsigned long m_PropertyListDeletedTag;
82  unsigned long m_PropertyListModifiedTag;
83 };
84 
85 #endif
Interface of property aliases service.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
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.