GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitParWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitParWidget.cpp 3114 2021-03-30 06:39:32Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "QFitParWidget.h"
15 
16 #include "TGo4FitParameter.h"
17 
18 QFitParWidget::QFitParWidget(QWidget *parent, const char* name)
19  : QFitNamedWidget(parent, name)
20 {
21  setupUi(this);
22  QObject::connect(ValueEdt, SIGNAL(textChanged(QString)), this, SLOT(ValueEdt_textChanged(QString)));
23  QObject::connect(ErrorEdt, SIGNAL(textChanged(QString)), this, SLOT(ErrorEdt_textChanged(QString)));
24  QObject::connect(RangeMinEdt, SIGNAL(textChanged(QString)), this, SLOT(RangeMinEdt_textChanged(QString)));
25  QObject::connect(RangeMaxEdt, SIGNAL(textChanged(QString)), this, SLOT(RangeMaxEdt_textChanged(QString)));
26  QObject::connect(EpsilonEdt, SIGNAL(textChanged(QString)), this, SLOT(EpsilonEdt_textChanged(QString)));
27  QObject::connect(FixedChk, SIGNAL(toggled(bool)), this, SLOT(FixedChk_toggled(bool)));
28  QObject::connect(RangeChk, SIGNAL(toggled(bool)), this, SLOT(RangeChk_toggled(bool)));
29  QObject::connect(EpsilonChk, SIGNAL(toggled(bool)), this, SLOT(EpsilonChk_toggled(bool)));
30 }
31 
33 {
34  return dynamic_cast<TGo4FitParameter*> (GetObject());
35 }
36 
38 {
40  TGo4FitParameter* fxParameter = GetPar();
41  if (fxParameter==0) return;
42 
43  ValueEdt->setText(QString::number(fxParameter->GetValue()));
44  ErrorEdt->setText(QString::number(fxParameter->GetError()));
45  FixedChk->setChecked(fxParameter->GetFixed());
46 
47  Double_t min, max;
48 
49  bool b = fxParameter->GetRange(min,max);
50 
51  RangeChk->setChecked(b);
52  RangeMinEdt->setEnabled(b);
53  RangeMaxEdt->setEnabled(b);
54 
55  RangeMinEdt->setText(QString::number(min));
56  RangeMaxEdt->setText(QString::number(max));
57 
58  Double_t eps;
59  b = fxParameter->GetEpsilon(eps);
60  EpsilonChk->setChecked(b);
61  EpsilonEdt->setEnabled(b);
62  EpsilonEdt->setText(QString::number(eps));
63 }
64 
65 void QFitParWidget::ValueEdt_textChanged( const QString & value)
66 {
67  if(!fbFillWidget && (GetPar()!=0)) {
68  bool ok;
69  double zn = value.toDouble(&ok);
70  if(ok) {
71  GetPar()->SetValue(zn);
72  SetWidgetItemText(true);
73  }
74  }
75 }
76 
77 void QFitParWidget::ErrorEdt_textChanged( const QString & value)
78 {
79  if(!fbFillWidget && (GetPar()!=0)) {
80  bool ok;
81  double zn = value.toDouble(&ok);
82  if(ok) GetPar()->SetError(zn);
83  }
84 }
85 
86 void QFitParWidget::RangeMinEdt_textChanged( const QString & value)
87 {
88  if(!fbFillWidget && (GetPar()!=0)) {
89  bool ok;
90  double zn = value.toDouble(&ok);
91  if(ok) GetPar()->ChangeRangeMin(zn);
92  }
93 }
94 
95 
96 void QFitParWidget::RangeMaxEdt_textChanged( const QString & value)
97 {
98  if(!fbFillWidget && (GetPar()!=0)) {
99  bool ok;
100  double zn = value.toDouble(&ok);
101  if(ok) GetPar()->ChangeRangeMax(zn);
102  }
103 }
104 
105 
106 void QFitParWidget::EpsilonEdt_textChanged( const QString & value)
107 {
108  if(!fbFillWidget && (GetPar()!=0)) {
109  bool ok;
110  double zn = value.toDouble(&ok);
111  if(ok) GetPar()->ChangeEpsilon(zn);
112  }
113 }
114 
116 {
117  if(!fbFillWidget && (GetPar()!=0))
118  GetPar()->SetFixed(zn);
119 }
120 
122 {
123  if(!fbFillWidget && (GetPar()!=0)) {
124  RangeMinEdt->setEnabled(zn);
125  RangeMaxEdt->setEnabled(zn);
126  GetPar()->SetRangeUse(zn);
127  }
128 }
129 
131 {
132  if(!fbFillWidget && (GetPar()!=0)) {
133  EpsilonEdt->setEnabled(zn);
134  GetPar()->SetEpsilonUse(zn);
135  }
136 }
void SetRangeUse(Bool_t use)
Bool_t GetFixed() const
void ChangeRangeMin(Double_t iRangeMin)
virtual void EpsilonEdt_textChanged(const QString &value)
void SetEpsilonUse(Bool_t use)
QFitParWidget(QWidget *parent=0, const char *name=0)
virtual void ValueEdt_textChanged(const QString &value)
void ChangeRangeMax(Double_t iRangeMax)
Bool_t GetRange(Double_t &min, Double_t &max) const
virtual void EpsilonChk_toggled(bool zn)
bool fbFillWidget
Definition: QFitWidget.h:63
virtual void RangeMinEdt_textChanged(const QString &value)
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:95
Double_t GetError() const
Bool_t GetEpsilon(Double_t &eps) const
virtual void FillSpecificData()
virtual TObject * GetObject()
Definition: QFitWidget.cpp:51
void SetValue(Double_t iValue)
Double_t GetValue() const
virtual void RangeChk_toggled(bool zn)
virtual void FillSpecificData()
void SetFixed(Bool_t iFixed)
virtual void FixedChk_toggled(bool zn)
virtual void RangeMaxEdt_textChanged(const QString &value)
virtual TGo4FitParameter * GetPar()
virtual void ErrorEdt_textChanged(const QString &value)
void SetError(Double_t iError)
void ChangeEpsilon(Double_t iEpsilon)