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

ENH : implement missing method in the EmptyParamter class in the core and QtGUI wrapper

parent 4e01052c
Branches
Tags
No related merge requests found
...@@ -44,10 +44,35 @@ public: ...@@ -44,10 +44,35 @@ public:
/** RTTI support */ /** RTTI support */
itkTypeMacro(EmptyParameter, Parameter); itkTypeMacro(EmptyParameter, Parameter);
bool HasValue() const
{
return m_Value;
}
virtual void ClearValue()
{
m_Value = false;
}
/** Set the value */
void SetValue( bool value)
{
// TODO check minimum/maximum
m_Value = value;
SetActive(true);
}
/**
* Implement the reset method (replace value by default value = false)
*/
virtual void Reset()
{
m_Value = false;
}
protected: protected:
/** Constructor */ /** Constructor */
EmptyParameter() EmptyParameter():m_Value(false)
{} {}
/** Destructor */ /** Destructor */
...@@ -58,7 +83,10 @@ private: ...@@ -58,7 +83,10 @@ private:
EmptyParameter(const EmptyParameter &); //purposely not implemented EmptyParameter(const EmptyParameter &); //purposely not implemented
void operator =(const EmptyParameter&); //purposely not implemented void operator =(const EmptyParameter&); //purposely not implemented
}; // End class Parameter /** Value */
bool m_Value;
}; // End class EmptyParameter
} // End namespace Wrapper } // End namespace Wrapper
} // End namespace otb } // End namespace otb
......
...@@ -46,6 +46,7 @@ void QtWidgetEmptyParameter::DoCreateWidget() ...@@ -46,6 +46,7 @@ void QtWidgetEmptyParameter::DoCreateWidget()
m_QCheckBox = new QCheckBox; m_QCheckBox = new QCheckBox;
m_QCheckBox->setToolTip(m_EmptyParam->GetDescription()); m_QCheckBox->setToolTip(m_EmptyParam->GetDescription());
connect(m_QCheckBox, SIGNAL(stateChanged(int)), this, SLOT(SetValue(int)));
QString optionID(m_EmptyParam->GetName()); QString optionID(m_EmptyParam->GetName());
m_QHBoxLayout->addWidget(m_QCheckBox); m_QHBoxLayout->addWidget(m_QCheckBox);
...@@ -54,5 +55,20 @@ void QtWidgetEmptyParameter::DoCreateWidget() ...@@ -54,5 +55,20 @@ void QtWidgetEmptyParameter::DoCreateWidget()
this->setLayout(m_QHBoxLayout); this->setLayout(m_QHBoxLayout);
} }
void QtWidgetEmptyParameter::SetValue( int value )
{
switch(value)
{
case Qt::Unchecked:
m_EmptyParam->SetValue(false);
break;
case Qt::PartiallyChecked:
break;
case Qt::Checked:
m_EmptyParam->SetValue(true);
break;
}
}
} }
} }
...@@ -38,6 +38,9 @@ public: ...@@ -38,6 +38,9 @@ public:
QtWidgetEmptyParameter(EmptyParameter*, QtWidgetModel*); QtWidgetEmptyParameter(EmptyParameter*, QtWidgetModel*);
virtual ~QtWidgetEmptyParameter(); virtual ~QtWidgetEmptyParameter();
protected slots:
void SetValue( int value );
private: private:
QtWidgetEmptyParameter(const QtWidgetEmptyParameter&); //purposely not implemented QtWidgetEmptyParameter(const QtWidgetEmptyParameter&); //purposely not implemented
void operator=(const QtWidgetEmptyParameter&); //purposely not implemented void operator=(const QtWidgetEmptyParameter&); //purposely not implemented
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment