MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkToolSelectionWidget.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15
16
18: QWidget(parent), m_Controls(nullptr)
19{
20 this->CreateQtPartControl( this );
21}
22
27
28
30{
31 if (!m_Controls)
32 {
33 // create GUI widgets
34 m_Controls = new Ui::QmitkToolSelectionWidgetControls;
35 m_Controls->setupUi(parent);
36 this->CreateConnections();
37 }
38}
39
40
42{
43 connect ( m_Controls->m_UseToolCheckBox, SIGNAL(toggled(bool)), this, SLOT(CheckBoxToggled(bool)) );
44 //connect ( m_Controls->m_ToolSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(void SelectedToolChanged(int)) );
45
46 //connect( (QObject*)(m_Controls->m_StartNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStartTimer()) );
47 //connect( (QObject*)(m_Controls->m_StopNavigationBtn), SIGNAL(clicked()), this, SLOT(OnStopTimer()) );
48 //connect( m_Controls->m_UpdateRateSB, SIGNAL(valueChanged(int)), this, SLOT(OnChangeTimerInterval(int)) );
49}
50
51
53{
54 return m_Controls->m_ToolSelectionComboBox->currentIndex();
55}
56
57void QmitkToolSelectionWidget::SetToolNames( const QStringList& toolNames )
58{
59 m_Controls->m_ToolSelectionComboBox->addItems(toolNames);
60}
61
62void QmitkToolSelectionWidget::AddToolName( const QString& toolName)
63{
64 m_Controls->m_ToolSelectionComboBox->addItem(toolName);
65}
66
67void QmitkToolSelectionWidget::ChangeToolName( int index, const QString& toolName )
68{
69 m_Controls->m_ToolSelectionComboBox->insertItem(index, toolName);
70}
71
72void QmitkToolSelectionWidget::RemoveToolName( const QString& toolName )
73{
74 for(int i=0; i < m_Controls->m_ToolSelectionComboBox->count(); ++i)
75 {
76 if(m_Controls->m_ToolSelectionComboBox->itemText(i).compare(toolName) == 0)
77 m_Controls->m_ToolSelectionComboBox->removeItem(i);
78 }
79}
80
82{
83 m_Controls->m_ToolSelectionComboBox->removeItem(index);
84}
85
87{
88 m_Controls->m_ToolSelectionComboBox->clear();
89}
90
91
93{
94 m_Controls->m_UseToolCheckBox->setText(text);
95}
96
98{
99 this->setEnabled( true );
100}
101
103{
104 this->setEnabled( false );
105}
106
107
109{
110 if(checked)
111 m_Controls->m_ToolSelectionComboBox->setEnabled(false);
112 else
113 m_Controls->m_ToolSelectionComboBox->setEnabled(true);
114
115 emit SignalUseTool(m_Controls->m_ToolSelectionComboBox->currentIndex(), checked);
116}
117
119{
120 return m_Controls->m_UseToolCheckBox->isChecked();
121}
QmitkToolSelectionWidget(QWidget *parent)
default constructor
~QmitkToolSelectionWidget() override
default destructor
void EnableWidget()
Enables this widget.
bool IsSelectedToolActivated()
This method returns whether the use tool checkbox is checked or not.
void AddToolName(const QString &toolName)
This method adds a single tool name at the end of the tool combobox. This method should be used after...
void ClearToolNames()
This method clears all tool names from the combobox.
void CreateConnections()
Creates this widget's signal slot connections.
void CreateQtPartControl(QWidget *parent)
void SetToolNames(const QStringList &toolNames)
This method sets the list with names of the available tools to the combobox. This method should be us...
int GetCurrentSelectedIndex()
This method returns the current selected index from the tool combobox.
void ChangeToolName(int index, const QString &toolName)
This method changes the tool name in the combobox at the given position.
void DisableWidget()
Disables this widget.
void RemoveToolName(const QString &toolName)
This method removes a single tool name from the combobox by name.
void SetCheckboxtText(const QString &text)
This method sets the text of the use tool checkbox.
void SignalUseTool(int index, bool use)
This signal is emitted when the checkbox is toggled. It provides the current selected tool id and whe...
void CheckBoxToggled(bool checked)
Slot which emits the SingalUseTool() after providing it with the tool id.
Ui::QmitkToolSelectionWidgetControls * m_Controls
gui widgets