Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkNavigationToolStorageSelectionWidget.cpp
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 
14 
15 //mitk headers
17 #include <usGetModuleContext.h>
18 #include <usServiceReference.h>
19 
20 
21 
23 : QWidget(parent, f)
24 {
25  m_Controls = nullptr;
26  CreateQtPartControl(this);
28 
29 }
30 
31 
33 {
34 
35 }
36 
38 {
39  if (!m_Controls)
40  {
41  // create GUI widgets
42  m_Controls = new Ui::QmitkNavigationToolStorageSelectionWidgetControls;
43  m_Controls->setupUi(parent);
44  }
45 }
46 
48 {
49  if ( m_Controls )
50  {
51  connect( (QObject*)(m_Controls->m_ServiceListWidget), SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(NavigationToolStorageSelected(us::ServiceReferenceU)) );
52  connect((QObject*)(m_Controls->m_ServiceListWidget), SIGNAL(ServiceModified(us::ServiceReferenceU)), this, SLOT(NavigationToolStorageSelected(us::ServiceReferenceU)));
53 
54 
55  }
56 
57  //initialize service list widget
58  std::string empty = "";
60 }
61 
63  {
64  if (!s) //nothing selected
65  {
66  //reset everything
67  m_CurrentStorage = nullptr;
69  return;
70  }
71 
72  // Get storage
73  us::ModuleContext* context = us::GetModuleContext();
74  m_CurrentStorage = context->GetService<mitk::NavigationToolStorage>(s);
76  }
77 
79  {
80  return this->m_CurrentStorage;
81  }
virtual void CreateConnections()
Creation of the connections.
An object of this class represents a collection of navigation tools. You may add/delete navigation to...
static const std::string US_PROPKEY_STORAGE_NAME
Ui::QmitkNavigationToolStorageSelectionWidgetControls * m_Controls
mitk::NavigationToolStorage::Pointer GetSelectedNavigationToolStorage()
void NavigationToolStorageSelected(mitk::NavigationToolStorage::Pointer storage)
This signal is emitted when a new navigation tool storage is selected.
QmitkNavigationToolStorageSelectionWidget(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.