MCPcopy Create free account
hub / github.com/MITK/MITK / SetView

Method SetView

Modules/QtWidgets/src/QmitkModelViewSelectionConnector.cpp:28–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void 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
55void QmitkModelViewSelectionConnector::SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes)
56{

Callers 6

InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
InitializeMethod · 0.80
CreateQtPartControlMethod · 0.80

Calls

no outgoing calls

Tested by 6

InitializeMethod · 0.64
InitializeMethod · 0.64
InitializeMethod · 0.64
InitializeMethod · 0.64
InitializeMethod · 0.64
CreateQtPartControlMethod · 0.64