ChronicAnemiaWidget.cxx 1.64 KB
Newer Older
1 2 3
/* Distributed under the Apache License, Version 2.0.
See accompanying NOTICE file for details.*/
#include "ChronicAnemiaWidget.h"
4
#include "controls/ScalarWidget.h"
5 6

#include "cdm/CommonDataModel.h"
7
#include "cdm/patient/conditions/SEChronicAnemia.h"
8 9
#include "cdm/properties/SEScalar0To1.h"

10
class QChronicAnemiaWidget::Controls
11 12 13
{
public:
  Controls() {}
14 15
  SEChronicAnemia Condition;
  QScalarWidget* ReductionFactor;
16 17
};

18
QChronicAnemiaWidget::QChronicAnemiaWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent, flags)
19 20
{
  m_Controls = new Controls();
21
  m_Controls->ReductionFactor = new QScalarWidget("Reduction Factor", 0, 1, 0.1, ScalarOptionWidget::None, this);
22 23
  layout()->addWidget(m_Controls->ReductionFactor);
  reset();
24 25 26 27 28 29 30
}

QChronicAnemiaWidget::~QChronicAnemiaWidget()
{
  delete m_Controls;
}

31 32
void QChronicAnemiaWidget::reset()
{
33
  QConditionWidget::reset();
34 35 36 37
  m_Controls->Condition.Clear();
  m_Controls->ReductionFactor->reset();
  enableProperties(false);
}
38

39 40 41 42 43
void QChronicAnemiaWidget::enableProperties(bool b)
{
  m_Controls->ReductionFactor->enableInput(b);
}
void QChronicAnemiaWidget::enableConverter(bool b)
44
{
45
}
46

47 48 49 50 51
const SECondition& QChronicAnemiaWidget::getCondition()
{
  m_Controls->Condition.Clear();
  m_Controls->ReductionFactor->getValue(m_Controls->Condition.GetReductionFactor());
  return m_Controls->Condition;
52 53
}

54
void QChronicAnemiaWidget::setCondition(const SECondition& c)
55
{
Aaron Bray's avatar
Aaron Bray committed
56
  m_Controls->Condition.Copy((SEChronicAnemia&)(c));
57 58
  m_Controls->ReductionFactor->setValue(m_Controls->Condition.GetReductionFactor());
  QConditionWidget::enableCondition(c.IsActive());
59 60
}