GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
QFitParWidget.cpp
Go to the documentation of this file.
1// $Id$
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
18QFitParWidget::QFitParWidget(QWidget *parent, const char *name)
19 : QFitNamedWidget(parent, name)
20{
21 setupUi(this);
22 QObject::connect(ValueEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::ValueEdt_textChanged);
23 QObject::connect(ErrorEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::ErrorEdt_textChanged);
24 QObject::connect(RangeMinEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::RangeMinEdt_textChanged);
25 QObject::connect(RangeMaxEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::RangeMaxEdt_textChanged);
26 QObject::connect(EpsilonEdt, &QGo4LineEdit::textChanged, this, &QFitParWidget::EpsilonEdt_textChanged);
27 QObject::connect(FixedChk, &QCheckBox::toggled, this, &QFitParWidget::FixedChk_toggled);
28 QObject::connect(RangeChk, &QCheckBox::toggled, this, &QFitParWidget::RangeChk_toggled);
29 QObject::connect(EpsilonChk, &QCheckBox::toggled, this, &QFitParWidget::EpsilonChk_toggled);
30}
31
33{
34 return dynamic_cast<TGo4FitParameter *>(GetObject());
35}
36
38{
40 TGo4FitParameter *fxParameter = GetPar();
41 if (!fxParameter) 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
65void QFitParWidget::ValueEdt_textChanged( const QString & value)
66{
67 if(!fbFillWidget && GetPar()) {
68 bool ok;
69 double zn = value.toDouble(&ok);
70 if(ok) {
71 GetPar()->SetValue(zn);
73 }
74 }
75}
76
77void QFitParWidget::ErrorEdt_textChanged( const QString & value)
78{
79 if(!fbFillWidget && GetPar()) {
80 bool ok;
81 double zn = value.toDouble(&ok);
82 if(ok) GetPar()->SetError(zn);
83 }
84}
85
86void QFitParWidget::RangeMinEdt_textChanged( const QString & value)
87{
88 if(!fbFillWidget && GetPar()) {
89 bool ok;
90 double zn = value.toDouble(&ok);
91 if(ok) GetPar()->ChangeRangeMin(zn);
92 }
93}
94
95
96void QFitParWidget::RangeMaxEdt_textChanged( const QString & value)
97{
98 if(!fbFillWidget && GetPar()) {
99 bool ok;
100 double zn = value.toDouble(&ok);
101 if(ok) GetPar()->ChangeRangeMax(zn);
102 }
103}
104
105
106void QFitParWidget::EpsilonEdt_textChanged( const QString & value)
107{
108 if(!fbFillWidget && GetPar()) {
109 bool ok;
110 double zn = value.toDouble(&ok);
111 if(ok) GetPar()->ChangeEpsilon(zn);
112 }
113}
114
116{
117 if(!fbFillWidget && GetPar())
118 GetPar()->SetFixed(zn);
119}
120
122{
123 if(!fbFillWidget && GetPar()) {
124 RangeMinEdt->setEnabled(zn);
125 RangeMaxEdt->setEnabled(zn);
126 GetPar()->SetRangeUse(zn);
127 }
128}
129
131{
132 if(!fbFillWidget && GetPar()) {
133 EpsilonEdt->setEnabled(zn);
134 GetPar()->SetEpsilonUse(zn);
135 }
136}
QFitNamedWidget(QWidget *parent=nullptr, const char *name=nullptr)
void FillSpecificData() override
virtual void RangeChk_toggled(bool zn)
virtual void ErrorEdt_textChanged(const QString &value)
virtual void EpsilonEdt_textChanged(const QString &value)
virtual void RangeMaxEdt_textChanged(const QString &value)
virtual void EpsilonChk_toggled(bool zn)
virtual TGo4FitParameter * GetPar()
void FillSpecificData() override
virtual void FixedChk_toggled(bool zn)
QFitParWidget(QWidget *parent=nullptr, const char *name=nullptr)
virtual void ValueEdt_textChanged(const QString &value)
virtual void RangeMinEdt_textChanged(const QString &value)
virtual TObject * GetObject()
bool fbFillWidget
Definition QFitWidget.h:63
virtual void SetWidgetItemText(bool trace)
Model and data objects parameter.
void ChangeEpsilon(Double_t iEpsilon)
Change epsilon value.
void ChangeRangeMax(Double_t iRangeMax)
Change value of range maximum.
void SetRangeUse(Bool_t use)
Change status, is range was specified or not.
void ChangeRangeMin(Double_t iRangeMin)
Change value of range minimum.
Bool_t GetEpsilon(Double_t &eps) const
Return value of parameter epsilon.
Double_t GetValue() const
Return parameter value.
void SetEpsilonUse(Bool_t use)
Set status, if epsilon value was specified or not.
Double_t GetError() const
Get value of parameter error.
Bool_t GetRange(Double_t &min, Double_t &max) const
Return range left (minimum) and right (maximum) values.
Bool_t GetFixed() const
Return status, if parameter fixed or not.
void SetError(Double_t iError)
Set value of parameter error.
void SetValue(Double_t iValue)
Set parameter value.
void SetFixed(Bool_t iFixed)
Set status of parameter fixed or not.