| 26 | } |
| 27 | |
| 28 | void QmitkModelViewSelectionConnector::SetView(QAbstractItemView* view) |
| 29 | { |
| 30 | if (nullptr != m_View) |
| 31 | { |
| 32 | disconnect(m_View->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(ChangeModelSelection(const QItemSelection&, const QItemSelection&))); |
| 33 | } |
| 34 | |
| 35 | // reset model-view pair and check for valid function argument |
| 36 | m_View = nullptr; |
| 37 | if (nullptr == view) |
| 38 | { |
| 39 | mitkThrow() << "Invalid item view. To use the model-view selection connector please specify a valid 'QAbstractItemView'."; |
| 40 | } |
| 41 | |
| 42 | auto storageModel = dynamic_cast<QmitkAbstractDataStorageModel*>(view->model()); |
| 43 | |
| 44 | if (storageModel == nullptr) |
| 45 | { |
| 46 | mitkThrow() << "Invalid data model. To use the model-view selection connector please set a valid 'QmitkAbstractDataStorageModel' for the given item view."; |
| 47 | } |
| 48 | |
| 49 | // a valid item view and a valid data model was found |
| 50 | m_View = view; |
| 51 | m_Model = storageModel; |
| 52 | connect(m_View->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), SLOT(ChangeModelSelection(const QItemSelection&, const QItemSelection&))); |
| 53 | } |
| 54 | |
| 55 | void QmitkModelViewSelectionConnector::SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes) |
| 56 | { |
no outgoing calls