QmitkTrackingSourcesCheckBoxPanelWidget. More...
#include <QmitkTrackingSourcesCheckBoxPanelWidget.h>
Public Types | |
| typedef std::vector< QCheckBox * > | TrackingSourcesCheckboxes |
Public Slots | |
| void | ClearPanel () |
| when action perfom button is clicked | |
Signals | |
| void | Selected (int id) |
| void | Deselected (int id) |
| when a checkbox is selected | |
| void | PerformAction () |
| when a checkbox is deselected | |
| void | StopAction () |
| when action perfom button is pressed | |
| void | Action () |
| when action perform button is released | |
Public Member Functions | |
| QmitkTrackingSourcesCheckBoxPanelWidget (QWidget *parent) | |
| vector with checkboxes for all set NDs | |
| virtual | ~QmitkTrackingSourcesCheckBoxPanelWidget () |
| default destructor | |
| void | ShowSourceCheckboxes () |
| Shows the checkboxes. | |
| void | SetNavigationDatas (std::vector< mitk::NavigationData::Pointer > *navDatas) |
| Sets the ND for this widget. | |
| void | AddNavigationData (mitk::NavigationData::Pointer nd) |
| Adds a ND. | |
| void | SetInfoText (QString text) |
| Sets this widget's info text. | |
| void | SetActionPerformButtonText (QString text) |
| Sets this widget's action perform button text. | |
| void | SetActionPerformButtonCheckable (bool checkable) |
| Sets whether the action perform button is checkable or not. | |
| void | HideActionPerformButton (bool hide) |
| Hides or shows the action perfom button. | |
| const std::vector< int > * | GetSelectedTrackingSourcesIDs () |
| Returns the selected tracking sources IDs. | |
| void | SelectAll () |
| Selects all checkboxes in this widget. | |
| void | DeselectAll () |
| Deselects all checkboxes in this widget. | |
| void | SelectCheckbox (unsigned int idx) |
| Selets the checkbox at the given position. | |
| void | DeselectCheckbox (unsigned int idx) |
| Deselects the checkbox at the given position. | |
| void | EnableCheckboxes (bool enable) |
| Enables or disabless the checkboxes in this widget. | |
| void | ClearSelectedIDs () |
| Clears the vector that holds the selected IDs. | |
Protected Slots | |
| void | OnCheckboxClicked (bool checked) |
| clearing checkboxes from panel | |
| void | OnPerformActionClicked (bool toggled) |
| void | OnPerformActionClicked () |
Protected Member Functions | |
| void | CreateConnections () |
| void | CreateQtPartControl (QWidget *parent) |
Protected Attributes | |
| Ui::QmitkTrackingSourcesCheckBoxPanelWidgetControls * | m_Controls |
| gui widgets | |
QmitkTrackingSourcesCheckBoxPanelWidget.
Widget for setting up and controlling an update timer in an IGT-Pipeline.
Definition at line 36 of file QmitkTrackingSourcesCheckBoxPanelWidget.h.
| typedef std::vector< QCheckBox* > QmitkTrackingSourcesCheckBoxPanelWidget::TrackingSourcesCheckboxes |
Definition at line 42 of file QmitkTrackingSourcesCheckBoxPanelWidget.h.
| QmitkTrackingSourcesCheckBoxPanelWidget::QmitkTrackingSourcesCheckBoxPanelWidget | ( | QWidget * | parent ) |
vector with checkboxes for all set NDs
default constructor
Definition at line 23 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References CreateQtPartControl().
: QWidget(parent), m_Controls(NULL), m_SourceCheckboxes(NULL), m_NavigationDatas(NULL), m_SelectedIds(NULL) { this->CreateQtPartControl( this ); m_SourceCheckboxes = new TrackingSourcesCheckboxes(); }
| QmitkTrackingSourcesCheckBoxPanelWidget::~QmitkTrackingSourcesCheckBoxPanelWidget | ( | ) | [virtual] |
default destructor
Definition at line 30 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
delete m_SelectedIds;
delete m_SourceCheckboxes;
delete m_NavigationDatas;
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::Action | ( | ) | [signal] |
when action perform button is released
Referenced by OnPerformActionClicked().
| void QmitkTrackingSourcesCheckBoxPanelWidget::AddNavigationData | ( | mitk::NavigationData::Pointer | nd ) |
Adds a ND.
Definition at line 63 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
if(m_NavigationDatas == NULL)
m_NavigationDatas = new std::vector<mitk::NavigationData::Pointer>();
if( nd.IsNotNull() )
m_NavigationDatas->push_back(nd);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::ClearPanel | ( | ) | [slot] |
when action perfom button is clicked
Definition at line 90 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References m_Controls, and Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_GridLayout.
{
while(m_Controls->m_GridLayout->count() > 0)
{
QWidget* actWidget = m_Controls->m_GridLayout->itemAt(0)->widget();
m_Controls->m_GridLayout->removeWidget(actWidget);
delete actWidget;
}
if(m_SourceCheckboxes != NULL || m_NavigationDatas != NULL)
{
m_SourceCheckboxes->clear();
m_NavigationDatas->clear();
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::ClearSelectedIDs | ( | ) |
Clears the vector that holds the selected IDs.
Definition at line 108 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
if(m_SelectedIds != NULL && !m_SelectedIds->empty())
m_SelectedIds->clear();
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::CreateConnections | ( | ) | [protected] |
Definition at line 49 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_ActionButton, m_Controls, and OnPerformActionClicked().
Referenced by CreateQtPartControl().
{
connect( (QPushButton*) m_Controls->m_ActionButton, SIGNAL(toggled(bool)), this, SLOT(OnPerformActionClicked(bool)) ) ;
connect( (QPushButton*) m_Controls->m_ActionButton, SIGNAL(clicked()), this, SLOT(OnPerformActionClicked()) ) ;
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::CreateQtPartControl | ( | QWidget * | parent ) | [protected] |
Definition at line 37 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References CreateConnections(), m_Controls, and Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::setupUi().
Referenced by QmitkTrackingSourcesCheckBoxPanelWidget().
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkTrackingSourcesCheckBoxPanelWidgetControls;
m_Controls->setupUi(parent);
this->CreateConnections();
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::DeselectAll | ( | ) |
Deselects all checkboxes in this widget.
Definition at line 162 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
for(unsigned int i=0; i< m_SourceCheckboxes->size(); i++)
{
m_SourceCheckboxes->at(i)->setChecked(false);
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::DeselectCheckbox | ( | unsigned int | idx ) |
Deselects the checkbox at the given position.
Definition at line 175 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
m_SourceCheckboxes->at(idx)->setChecked(false);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::Deselected | ( | int | id ) | [signal] |
when a checkbox is selected
Referenced by OnCheckboxClicked().
| void QmitkTrackingSourcesCheckBoxPanelWidget::EnableCheckboxes | ( | bool | enable ) |
Enables or disabless the checkboxes in this widget.
Definition at line 146 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
for(unsigned int i=0; i< m_SourceCheckboxes->size(); i++)
{
m_SourceCheckboxes->at(i)->setEnabled(enable);
}
}
| const std::vector< int > * QmitkTrackingSourcesCheckBoxPanelWidget::GetSelectedTrackingSourcesIDs | ( | ) |
Returns the selected tracking sources IDs.
Definition at line 74 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
if(m_SelectedIds == NULL)
m_SelectedIds = new std::vector<int>();
else
m_SelectedIds->clear();
for (unsigned int i=0; i < m_SourceCheckboxes->size(); i++)
{
if(m_SourceCheckboxes->at(i)->isChecked())
m_SelectedIds->push_back(i);
}
return m_SelectedIds;
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::HideActionPerformButton | ( | bool | hide ) |
Hides or shows the action perfom button.
Definition at line 219 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_ActionButton, and m_Controls.
{
if(hide)
m_Controls->m_ActionButton->hide();
else
m_Controls->m_ActionButton->show();
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::OnCheckboxClicked | ( | bool | checked ) | [protected, slot] |
clearing checkboxes from panel
Definition at line 181 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Deselected(), and Selected().
Referenced by ShowSourceCheckboxes().
{
QCheckBox* sender = qobject_cast< QCheckBox* > (QObject::sender());
if( sender == NULL )
throw std::invalid_argument("No sender found!");
int idx = -1;
for(unsigned int i=0 ;i < m_SourceCheckboxes->size(); i++)
{
if(sender == m_SourceCheckboxes->at(i))
{ idx=i;
break;
}
}
if(idx>-1)
{
if(checked)
emit Selected(idx);
else
emit Deselected(idx);
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::OnPerformActionClicked | ( | bool | toggled ) | [protected, slot] |
Definition at line 236 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References PerformAction(), and StopAction().
{
if(toggled)
emit PerformAction();
else
emit StopAction();
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::OnPerformActionClicked | ( | ) | [protected, slot] |
Definition at line 244 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Action().
Referenced by CreateConnections().
{
emit Action();
}| void QmitkTrackingSourcesCheckBoxPanelWidget::PerformAction | ( | ) | [signal] |
when a checkbox is deselected
Referenced by OnPerformActionClicked().
| void QmitkTrackingSourcesCheckBoxPanelWidget::SelectAll | ( | ) |
Selects all checkboxes in this widget.
Definition at line 154 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
for(unsigned int i=0; i< m_SourceCheckboxes->size(); i++)
{
m_SourceCheckboxes->at(i)->setChecked(true);
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::SelectCheckbox | ( | unsigned int | idx ) |
Selets the checkbox at the given position.
Definition at line 170 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
m_SourceCheckboxes->at(idx)->setChecked(true);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::Selected | ( | int | id ) | [signal] |
Referenced by OnCheckboxClicked().
| void QmitkTrackingSourcesCheckBoxPanelWidget::SetActionPerformButtonCheckable | ( | bool | checkable ) |
Sets whether the action perform button is checkable or not.
Definition at line 228 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_ActionButton, and m_Controls.
{
if(checkable)
m_Controls->m_ActionButton->setCheckable(true);
else
m_Controls->m_ActionButton->setCheckable(false);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::SetActionPerformButtonText | ( | QString | text ) |
Sets this widget's action perform button text.
Definition at line 213 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_ActionButton, and m_Controls.
{
m_Controls->m_ActionButton->setText(text);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::SetInfoText | ( | QString | text ) |
Sets this widget's info text.
Definition at line 208 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References m_Controls, and Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_InfoLabel.
{
m_Controls->m_InfoLabel->setText(text);
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::SetNavigationDatas | ( | std::vector< mitk::NavigationData::Pointer > * | navDatas ) |
Sets the ND for this widget.
Definition at line 56 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
{
if( navDatas != NULL )
m_NavigationDatas = navDatas;
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::ShowSourceCheckboxes | ( | ) |
Shows the checkboxes.
Definition at line 114 of file QmitkTrackingSourcesCheckBoxPanelWidget.cpp.
References m_Controls, Ui_QmitkTrackingSourcesCheckBoxPanelWidgetControls::m_GridLayout, and OnCheckboxClicked().
{
if( m_SourceCheckboxes != NULL )
m_SourceCheckboxes->clear();
if( m_NavigationDatas == NULL )
return;
QCheckBox* checkBox;
int row = 0;
int column;
for(unsigned int i=0; i < m_NavigationDatas->size(); i++) // puts a radiobutton for every tracking source output in a 2 columns QGridLayout
{
column = i % 4;
if( i>0 && i%4==0 )
row++;
QString name(m_NavigationDatas->at(i).GetPointer()->GetName());
checkBox = new QCheckBox(name, this);
connect( checkBox, SIGNAL(toggled(bool)), this , SLOT(OnCheckboxClicked(bool)) );
m_SourceCheckboxes->push_back(checkBox);
m_Controls->m_GridLayout->addWidget(checkBox,row,column);
}
}
| void QmitkTrackingSourcesCheckBoxPanelWidget::StopAction | ( | ) | [signal] |
when action perfom button is pressed
Referenced by OnPerformActionClicked().
Ui::QmitkTrackingSourcesCheckBoxPanelWidgetControls* QmitkTrackingSourcesCheckBoxPanelWidget::m_Controls [protected] |
gui widgets
Definition at line 142 of file QmitkTrackingSourcesCheckBoxPanelWidget.h.
Referenced by ClearPanel(), CreateConnections(), CreateQtPartControl(), HideActionPerformButton(), SetActionPerformButtonCheckable(), SetActionPerformButtonText(), SetInfoText(), and ShowSourceCheckboxes().
1.7.2