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