Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
QmitkRenderWindowDataNodeTableModel.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 QmitkRenderWindowDataNodeTableModel_h
14 #define QmitkRenderWindowDataNodeTableModel_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 //mitk core
19 #include <mitkBaseRenderer.h>
20 #include <mitkBaseProperty.h>
21 #include <mitkDataStorage.h>
22 #include <mitkWeakPointer.h>
23 
24 // qt widgets module
28 
29 #include <QIcon>
30 
31 /*
32 * @brief The 'QmitkRenderWindowDataNodeTableModel' is a table model that extends the 'QAbstractItemModel'.
33 */
35 {
36  Q_OBJECT
37 
38 public:
39 
40  QmitkRenderWindowDataNodeTableModel(QObject* parent = nullptr);
41 
43 
44  void SetDataStorage(mitk::DataStorage* dataStorage);
46  mitk::BaseRenderer::Pointer GetCurrentRenderer() const;
47 
48  using NodeList = QList<mitk::DataNode::Pointer>;
49  void SetCurrentSelection(NodeList selectedNodes);
51 
52  // override from 'QAbstractItemModel'
53  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
54  QModelIndex parent(const QModelIndex& child) const override;
55 
56  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
57  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
58 
59  QVariant data(const QModelIndex& index, int role) const override;
60  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
61 
62  Qt::ItemFlags flags(const QModelIndex& index) const override;
63 
64  Qt::DropActions supportedDropActions() const override;
65  Qt::DropActions supportedDragActions() const override;
66  QStringList mimeTypes() const override;
67  QMimeData* mimeData(const QModelIndexList& indexes) const override;
68 
69  void moveNodesLayer(QSet<mitk::DataNode*> movedNodes, int targetLayer);
70  bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
71 
72 Q_SIGNALS:
73 
74  void ModelUpdated();
75  void NodesLayerMoved(QSet<mitk::DataNode*> nodes, int layer);
76 
77 private:
78 
79  std::unique_ptr<mitk::RenderWindowLayerController> m_RenderWindowLayerController;
81  NodeList m_CurrentSelection;
82 
83  QIcon m_VisibleIcon;
84  QIcon m_InvisibleIcon;
85  QIcon m_ArrowIcon;
86  QIcon m_TimesIcon;
87 };
88 
89 #endif
#define MITKQTWIDGETS_EXPORT
QmitkRenderWindowDataNodeTableModel(QObject *parent=nullptr)
Qt::DropActions supportedDropActions() const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role) const override
QModelIndex parent(const QModelIndex &child) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void NodesLayerMoved(QSet< mitk::DataNode * > nodes, int layer)
void SetDataStorage(mitk::DataStorage *dataStorage)
Qt::DropActions supportedDragActions() const override
mitk::BaseRenderer::Pointer GetCurrentRenderer() const
QMimeData * mimeData(const QModelIndexList &indexes) const override
void SetCurrentSelection(NodeList selectedNodes)
Qt::ItemFlags flags(const QModelIndex &index) const override
void moveNodesLayer(QSet< mitk::DataNode * > movedNodes, int targetLayer)
void SetCurrentRenderer(mitk::BaseRenderer *baseRenderer)
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
QStringList mimeTypes() const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Data management class that handles 'was created by' relations.