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
Branches
Tags
No related merge requests found
......@@ -77,31 +77,22 @@ void QtWidgetParameterGroup::DoCreateWidget()
connect( checkBox, SIGNAL(clicked(bool)), GetModel(), SLOT(NotifyUpdate()) );
connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), checkBox, SLOT(setChecked(bool)));
connect( specificWidget, SIGNAL(ParameterActiveStatus(bool)), specificWidget, SLOT(SetActivationState(bool)));
if (param->IsRoot())
{
// if Mandatory make the checkbox checked and deactivated
if (param->GetMandatory())
{
checkBox->setCheckState(Qt::Checked);
checkBox->setEnabled(false);
specificWidget->setEnabled(true);
}
else
{
checkBox->setCheckState(Qt::Unchecked);
checkBox->setEnabled(true);
specificWidget->setEnabled(false);
}
// if Mandatory make the checkbox checked and deactivated
if (param->GetMandatory())
{
checkBox->setCheckState(Qt::Checked);
checkBox->setEnabled(false);
specificWidget->setEnabled(true);
}
else
{
// If this widget belongs to a Group, make it disabled by
// defaut
checkBox->setCheckState(Qt::Unchecked);
checkBox->setEnabled(true);
specificWidget->setEnabled(false);
}
gridLayout->addWidget(checkBox, i, 0);
gridLayout->addWidget(checkBox, i, 0);
m_WidgetList.push_back(specificWidget);
}
else
......@@ -117,6 +108,18 @@ void QtWidgetParameterGroup::DoCreateWidget()
if (!param->GetMandatory() )
{
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)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment