Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkModelViewSelectionConnector.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 QmitkModelViewSelectionConnector_h
14 #define QmitkModelViewSelectionConnector_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 // qt widgets module
20 
21  // qt
22 #include <QAbstractItemView>
23 
40 {
41  Q_OBJECT
42 
43 public:
44 
46 
57  void SetView(QAbstractItemView* view);
58 
63  QList<mitk::DataNode::Pointer> GetSelectedNodes() const;
64 
71 
72 Q_SIGNALS:
81  void CurrentSelectionChanged(QList<mitk::DataNode::Pointer> nodes);
82 
83 public Q_SLOTS:
94  void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
95 
106  void SetCurrentSelection(QList<mitk::DataNode::Pointer> selectedNodes);
107 
108 private Q_SLOTS:
119  void ChangeModelSelection(const QItemSelection& selected, const QItemSelection& deselected);
120 
121 private:
122 
124  QAbstractItemView* m_View;
125 
126  bool m_SelectOnlyVisibleNodes;
127  QList<mitk::DataNode::Pointer> m_NonVisibleSelection;
128 
136  QList<mitk::DataNode::Pointer> GetInternalSelectedNodes() const;
143  QList<mitk::DataNode::Pointer> FilterNodeList(const QList<mitk::DataNode::Pointer>& nodes) const;
144 };
145 
153 bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList<mitk::DataNode::Pointer>& selection1, const QList<mitk::DataNode::Pointer>& selection2);
154 
155 #endif
#define MITKQTWIDGETS_EXPORT
bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList< mitk::DataNode::Pointer > &selection1, const QList< mitk::DataNode::Pointer > &selection2)
Compares two node selections for equality regardless of order.
Abstract base class extending QAbstractItemModel for DataStorage-backed models.
Bridges the selection between a Qt model-view pair and external MITK node selections.
void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes)
Controls whether selections are restricted to visible nodes.
bool GetSelectOnlyVisibleNodes() const
Returns whether only visible nodes can be selected.
void CurrentSelectionChanged(QList< mitk::DataNode::Pointer > nodes)
Emitted when the view's selection changes.
void SetCurrentSelection(QList< mitk::DataNode::Pointer > selectedNodes)
Applies the given node list as the view's selection.
void SetView(QAbstractItemView *view)
Sets the view whose selection model is used for selection synchronization.
QList< mitk::DataNode::Pointer > GetSelectedNodes() const
Returns the currently selected data nodes.