Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 #include <mitkCoreServices.h>
21 
22 class QmitkPropertyItem;
23 
24 namespace berry
25 {
26  struct IBerryPreferences;
27 }
28 
29 namespace mitk
30 {
31  enum
32  {
33  PropertyRole = Qt::UserRole + 1
34  };
35 }
36 
37 class MITKQTWIDGETS_EXPORT QmitkPropertyItemModel : public QAbstractItemModel
38 {
39  Q_OBJECT
40 
41 public:
42  explicit QmitkPropertyItemModel(QObject *parent = nullptr);
43  ~QmitkPropertyItemModel() override;
44 
45  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
46  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
47  Qt::ItemFlags flags(const QModelIndex &index) const override;
48  mitk::PropertyList *GetPropertyList() const;
49  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
50  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
51  QModelIndex parent(const QModelIndex &child) const override;
52  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
53  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
54  void SetPropertyList(mitk::PropertyList *propertyList, const QString &className = "");
55  void Update();
56 
57 private:
58  void CreateRootItem();
59  QModelIndex FindProperty(const mitk::BaseProperty *property);
60  void OnPropertyListModified();
61  void OnPropertyListDeleted();
62  void OnPropertyModified(const itk::Object *property, const itk::EventObject &event);
63  void SetNewPropertyList(mitk::PropertyList *newPropertyList);
64 
68  QString m_ClassName;
69  std::unique_ptr<QmitkPropertyItem> m_RootItem;
70  std::map<std::string, unsigned long> m_PropertyDeletedTags;
71  std::map<std::string, unsigned long> m_PropertyModifiedTags;
72  unsigned long m_PropertyListDeletedTag;
73  unsigned long m_PropertyListModifiedTag;
74 };
75 
76 #endif
QmitkPropertyItemModel
Definition: QmitkPropertyItemModel.h:37
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkPropertyItem
Definition: QmitkPropertyItem.h:19
mitk::CoreServicePointer< mitk::IPropertyAliases >
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkCoreServices.h
mitk::PropertyRole
@ PropertyRole
Definition: QmitkPropertyItemModel.h:33
MitkQtWidgetsExports.h
mitkPropertyList.h
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitkWeakPointer.h
mitk::WeakPointer< mitk::PropertyList >
berry
Definition: QmitkPropertyItemModel.h:24