Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berryPerspectiveListModel.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 BERRYPERSPECTIVELISTMODEL_H
14 #define BERRYPERSPECTIVELISTMODEL_H
15 
17 
18 #include <berrySmartPointer.h>
19 
20 #include <QAbstractListModel>
21 #include <QScopedPointer>
22 
23 namespace berry {
24 
25 struct IPerspectiveDescriptor;
26 struct IPerspectiveRegistry;
27 
28 class BERRY_UI_QT PerspectiveListModel : public QAbstractListModel
29 {
30  Q_OBJECT
31 
32 public:
33 
34  enum Role {
35  Id = Qt::UserRole,
36  Description
37  };
38 
39  PerspectiveListModel(IPerspectiveRegistry& perspReg, bool markDefault = true, QObject* parent = nullptr);
40  ~PerspectiveListModel() override;
41 
42  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
43  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
44  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
45 
46  QString perspectiveName(const QModelIndex& index) const;
47  SmartPointer<IPerspectiveDescriptor> perspectiveDescriptor(const QModelIndex& index) const;
48 
49  using QAbstractListModel::index;
50  QModelIndex index(const QString& perspId) const;
51 
52 private:
53 
54  struct Impl;
55  QScopedPointer<Impl> d;
56 };
57 
58 }
59 
60 #endif // BERRYPERSPECTIVELISTMODEL_H
org_blueberry_ui_qt_Export.h
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::PerspectiveListModel
Definition: berryPerspectiveListModel.h:28
berrySmartPointer.h
berry::PerspectiveListModel::Role
Role
Definition: berryPerspectiveListModel.h:34
berry::IPerspectiveRegistry
Definition: berryIPerspectiveRegistry.h:36
berry
Definition: QmitkPropertyItemModel.h:24