Bridges the selection between a Qt model-view pair and external MITK node selections.
More...
#include <QmitkModelViewSelectionConnector.h>
Bridges the selection between a Qt model-view pair and external MITK node selections.
This class accepts a QAbstractItemView (whose model must be a QmitkAbstractDataStorageModel) and translates between the view's QItemSelectionModel and lists of mitk::DataNode::Pointer. It can both propagate selection changes outward (via the CurrentSelectionChanged signal) and accept incoming selections (via the SetCurrentSelection slot).
When selectOnlyVisibleNodes is false, the connector also stores non-visible nodes from an incoming selection so they can be merged into outgoing selection signals, preserving the full original selection even when the view can only display a subset.
- See also
- QmitkAbstractDataStorageInspector
-
QmitkAbstractDataStorageModel
Definition at line 39 of file QmitkModelViewSelectionConnector.h.
◆ QmitkModelViewSelectionConnector()
| QmitkModelViewSelectionConnector::QmitkModelViewSelectionConnector |
( |
| ) |
|
◆ CurrentSelectionChanged
| void QmitkModelViewSelectionConnector::CurrentSelectionChanged |
( |
QList< mitk::DataNode::Pointer > |
nodes | ) |
|
|
signal |
Emitted when the view's selection changes.
The node list includes non-visible nodes from a previous SetCurrentSelection call if selectOnlyVisibleNodes is false.
- Parameters
-
| [in] | nodes | The newly selected data nodes. |
◆ GetSelectedNodes()
| QList<mitk::DataNode::Pointer> QmitkModelViewSelectionConnector::GetSelectedNodes |
( |
| ) |
const |
Returns the currently selected data nodes.
- Returns
- A list of currently selected mitk::DataNode::Pointer objects.
◆ GetSelectOnlyVisibleNodes()
| bool QmitkModelViewSelectionConnector::GetSelectOnlyVisibleNodes |
( |
| ) |
const |
Returns whether only visible nodes can be selected.
- Returns
- True if only visible nodes are selectable.
- See also
- SetSelectOnlyVisibleNodes
◆ SetCurrentSelection
| void QmitkModelViewSelectionConnector::SetCurrentSelection |
( |
QList< mitk::DataNode::Pointer > |
selectedNodes | ) |
|
|
slot |
Applies the given node list as the view's selection.
The nodes are looked up in the model to find matching indexes. If selectOnlyVisibleNodes is false, nodes not present in the model are stored and merged into subsequent outgoing CurrentSelectionChanged signals.
- Parameters
-
| [in] | selectedNodes | The data nodes to select. |
- See also
- SetSelectOnlyVisibleNodes
◆ SetSelectOnlyVisibleNodes
| void QmitkModelViewSelectionConnector::SetSelectOnlyVisibleNodes |
( |
bool |
selectOnlyVisibleNodes | ) |
|
|
slot |
Controls whether selections are restricted to visible nodes.
If true, incoming selections are filtered to only those nodes matching the model's predicate (i.e., visible in the view). If false, non-visible nodes are stored and included in outgoing selection signals.
- Parameters
-
| [in] | selectOnlyVisibleNodes | True to restrict to visible nodes. |
- See also
- GetSelectOnlyVisibleNodes
◆ SetView()
| void QmitkModelViewSelectionConnector::SetView |
( |
QAbstractItemView * |
view | ) |
|
Sets the view whose selection model is used for selection synchronization.
The view's data model is extracted and must be a QmitkAbstractDataStorageModel. The model must return mitk::DataNode::Pointer objects for the QmitkDataNodeRole.
- Parameters
-
| [in] | view | The view to connect to. |
- Precondition
- The view must be valid and its model must be a QmitkAbstractDataStorageModel.
- Exceptions
-
The documentation for this class was generated from the following file: