Skip to content
Snippets Groups Projects
Commit 6e977652 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: Better handling of a Group and its parameter

     Mandatory Group : no checkbox, all the mandatory params are activated
     Non Mandatory Group : checkbox (non checked by default), all the params are deactivated
parent 6b79b3ab
No related branches found
No related tags found
No related merge requests found
...@@ -77,31 +77,22 @@ void QtWidgetParameterGroup::DoCreateWidget() ...@@ -77,31 +77,22 @@ void QtWidgetParameterGroup::DoCreateWidget()
connect( checkBox, SIGNAL(clicked(bool)), GetModel(), SLOT(NotifyUpdate()) ); connect( checkBox, SIGNAL(clicked(bool)), GetModel(), SLOT(NotifyUpdate()) );
connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), checkBox, SLOT(setChecked(bool))); connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), checkBox, SLOT(setChecked(bool)));
connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), specificWidget, SLOT(SetActivationState(bool))); connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), specificWidget, SLOT(SetActivationState(bool)));
if (param->IsRoot()) // if Mandatory make the checkbox checked and deactivated
{ if (param->GetMandatory())
// if Mandatory make the checkbox checked and deactivated {
if (param->GetMandatory()) checkBox->setCheckState(Qt::Checked);
{ checkBox->setEnabled(false);
checkBox->setCheckState(Qt::Checked); specificWidget->setEnabled(true);
checkBox->setEnabled(false);
specificWidget->setEnabled(true);
}
else
{
checkBox->setCheckState(Qt::Unchecked);
checkBox->setEnabled(true);
specificWidget->setEnabled(false);
}
} }
else else
{ {
// If this widget belongs to a Group, make it disabled by checkBox->setCheckState(Qt::Unchecked);
// defaut checkBox->setEnabled(true);
specificWidget->setEnabled(false); specificWidget->setEnabled(false);
} }
gridLayout->addWidget(checkBox, i, 0);
gridLayout->addWidget(checkBox, i, 0);
m_WidgetList.push_back(specificWidget); m_WidgetList.push_back(specificWidget);
} }
else else
...@@ -117,6 +108,18 @@ void QtWidgetParameterGroup::DoCreateWidget() ...@@ -117,6 +108,18 @@ void QtWidgetParameterGroup::DoCreateWidget()
if (!param->GetMandatory() ) if (!param->GetMandatory() )
{ {
group->setCheckable(true); group->setCheckable(true);
group->setChecked(false);
// Update iteratively the children status
for (unsigned int idx = 0; idx < param->GetChildrenList().size(); ++idx)
{
// deactivate the children tree
this->ProcessChild(param->GetChildrenList()[idx], false);
}
}
else
{
param->SetActive(true);
} }
connect(group, SIGNAL(clicked(bool)), specificWidget, SLOT(SetActivationState(bool))); connect(group, SIGNAL(clicked(bool)), specificWidget, SLOT(SetActivationState(bool)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment