Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkRenderWindowDataStorageListModel.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 QmitkRenderWindowDataStorageListModel_h
14 #define QmitkRenderWindowDataStorageListModel_h
15 
16 // render window manager UI model
18 
19 // render window manager module
22 
23 //mitk core
24 #include <mitkBaseRenderer.h>
25 
26 // qt widgets module
28 
46 {
47  Q_OBJECT
48 
49 public:
50 
58  QmitkRenderWindowDataStorageListModel(QObject* parent = nullptr);
59 
65  void DataStorageChanged() override;
66 
70  void NodePredicateChanged() override;
71 
80  void NodeAdded(const mitk::DataNode* node) override;
81 
89  void NodeChanged(const mitk::DataNode* node) override;
90 
96  void NodeRemoved(const mitk::DataNode* node) override;
97 
106  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
107 
114  QModelIndex parent(const QModelIndex& child) const override;
115 
122  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
123 
130  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
131 
147  QVariant data(const QModelIndex& index, int role) const override;
148 
160  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
161 
171  Qt::ItemFlags flags(const QModelIndex& index) const override;
172 
178  Qt::DropActions supportedDropActions() const override;
179 
185  Qt::DropActions supportedDragActions() const override;
186 
194  QStringList mimeTypes() const override;
195 
205  QMimeData* mimeData(const QModelIndexList& indexes) const override;
206 
220  bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
221 
231 
240 
246  mitk::BaseRenderer::Pointer GetCurrentRenderer() const;
247 
257 
258 private:
259 
260  void UpdateModelData();
261 
262  std::unique_ptr<mitk::RenderWindowLayerController> m_RenderWindowLayerController;
265 
266 };
267 
268 #endif
#define MITKRENDERWINDOWMANAGERUI_EXPORT
Abstract base class extending QAbstractItemModel for DataStorage-backed models.
List model that displays the layer stack for a specific render window with drag-and-drop support.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Set data for the given index and role (visibility toggling).
mitk::BaseRenderer::Pointer GetCurrentRenderer() const
Get the currently active base renderer.
void SetControlledRenderer(mitk::RenderWindowLayerUtilities::RendererVector controlledRenderer)
Set the list of controlled renderers and initialize layer data for all nodes.
QModelIndex parent(const QModelIndex &child) const override
Return the parent index (always invalid, since this is a flat list model).
QmitkRenderWindowDataStorageListModel(QObject *parent=nullptr)
Construct the list model.
void AddDataNodeToAllRenderer(mitk::DataNode *dataNode)
Insert the given data node into all controlled render windows at the top layer.
Qt::DropActions supportedDragActions() const override
Return supported drag actions (Copy and Move).
void NodeAdded(const mitk::DataNode *node) override
Called when a data node has been added to the data storage.
void NodeChanged(const mitk::DataNode *node) override
Called when a data node has been changed.
QMimeData * mimeData(const QModelIndexList &indexes) const override
Create MIME data for the given model indices.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Return the number of columns (always 1).
Qt::DropActions supportedDropActions() const override
Return supported drop actions (Copy and Move).
void SetCurrentRenderer(mitk::BaseRenderer *baseRenderer)
Set the current base renderer and refresh the model.
QStringList mimeTypes() const override
Return the list of supported MIME types for drag-and-drop.
Qt::ItemFlags flags(const QModelIndex &index) const override
Return item flags for the given index.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handle dropped MIME data to reorder layers.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Return the number of rows (layers) in the model.
void NodePredicateChanged() override
Called when the node predicate has been changed. Refreshes the model data.
void DataStorageChanged() override
Called when the data storage has been changed.
QVariant data(const QModelIndex &index, int role) const override
Return data for the given index and role.
void NodeRemoved(const mitk::DataNode *node) override
Called when a data node has been removed from the data storage. Refreshes the model.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Create a model index for the given row and column.
Organizes the rendering process.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
std::vector< BaseRenderer * > RendererVector
std::map< int, DataNode::Pointer, std::greater< int > > LayerStack