Medical Imaging Interaction Toolkit  2023.12.99-7a59bd54
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 
46 {
47  Q_OBJECT
48 
49 public:
50 
63  void SetView(QAbstractItemView* view);
64 
68  QList<mitk::DataNode::Pointer> GetSelectedNodes() const;
69 
70  bool GetSelectOnlyVisibleNodes() const;
71 
72 Q_SIGNALS:
79  void CurrentSelectionChanged(QList<mitk::DataNode::Pointer> nodes);
80 
81 public Q_SLOTS:
94  void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
95 
108  void SetCurrentSelection(QList<mitk::DataNode::Pointer> selectedNodes);
109 
110 private Q_SLOTS:
121  void ChangeModelSelection(const QItemSelection& selected, const QItemSelection& deselected);
122 
123 private:
124 
126  QAbstractItemView* m_View;
127 
128  bool m_SelectOnlyVisibleNodes;
129  QList<mitk::DataNode::Pointer> m_NonVisibleSelection;
130 
131  /*
132  * @brief Retrieve the currently selected nodes from the selection model of the private member item view by
133  * transforming the selection indexes into a data node list.
134  *
135  * In order to transform the indices into data nodes, the private data storage model must return
136  * 'mitk::DataNode::Pointer' objects for model indexes if the role is QmitkDataNodeRole.
137  */
138  QList<mitk::DataNode::Pointer> GetInternalSelectedNodes() const;
139  /*
140  * @brief Filter the list of given nodes such that only those nodes are used that are valid
141  * when using the data storage model's node predicate.
142  * If no node predicate was set or the data storage model is invalid, the input list
143  * of given nodes is returned.
144  */
145  QList<mitk::DataNode::Pointer> FilterNodeList(const QList<mitk::DataNode::Pointer>& nodes) const;
146 };
147 
148 /*
149 * @brief Return true, if the nodes in the list of two given selections are equal (Sorting is ignored. Any permutation is valid.)*/
150 bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList<mitk::DataNode::Pointer>& selection1, const QList<mitk::DataNode::Pointer>& selection2);
151 
152 #endif
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkModelViewSelectionConnector
The 'QmitkModelViewSelectionConnector' is used to handle the selections of a model-view-pair and to s...
Definition: QmitkModelViewSelectionConnector.h:45
EqualNodeSelections
bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList< mitk::DataNode::Pointer > &selection1, const QList< mitk::DataNode::Pointer > &selection2)
QmitkAbstractDataStorageModel.h
MitkQtWidgetsExports.h
AbstractDataNodeAction::GetSelectedNodes
MITK_QT_APP QList< mitk::DataNode::Pointer > GetSelectedNodes(berry::IWorkbenchPartSite::Pointer workbenchPartSite)
QmitkAbstractDataStorageModel
Definition: QmitkAbstractDataStorageModel.h:40