GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitDependencyWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitDependencyWidget.cpp 3106 2021-03-29 17:35:56Z 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 "QFitDependencyWidget.h"
15 
16 #include "QFitItem.h"
17 #include "TObjArray.h"
18 #include "TGo4FitDependency.h"
19 
20 QFitDependencyWidget::QFitDependencyWidget(QWidget *parent, const char* name)
21  : QFitWidget(parent, name)
22 {
23  setupUi(this);
24 
25  QObject::connect(ParamEdit, SIGNAL(textChanged(QString)), this, SLOT(ParamEdit_textChanged(QString)));
26  QObject::connect(ExpressionEdt, SIGNAL(textChanged(QString)), this, SLOT(ExpressionEdt_textChanged(QString)));
27 }
28 
30 {
31  return dynamic_cast<TGo4FitDependency*> (GetObject());
32 }
33 
35 {
36  if(GetDepen()) {
37  if (GetDepen()->IsResultDepend()) {
38  TObjArray* lst = dynamic_cast<TObjArray*> (GetItem()->Parent()->Object());
39  ParamEdit->setText(QString("Result ")+QString::number(lst->IndexOf(GetObject())));
40  ParamEdit->setReadOnly(true);
41  ParamEdit->setEnabled(false);
42  } else {
43  ParamEdit->setText(GetDepen()->GetParameter().Data());
44  ParamEdit->setReadOnly(false);
45  ParamEdit->setEnabled(true);
46  }
47  if (GetDepen()->IsInitValue()) ExpressionEdt->setText(QString::number(GetDepen()->GetInitValue()));
48  else ExpressionEdt->setText(GetDepen()->GetExpression().Data());
49  }
50 }
51 
52 
53 void QFitDependencyWidget::ParamEdit_textChanged( const QString & param)
54 {
55  if(!fbFillWidget && GetDepen() && (param.length()>0)) {
56  GetDepen()->SetParameter(param.toLatin1().constData());
57  SetWidgetItemText(true);
58  }
59 }
60 
61 
63 {
64  if(!fbFillWidget && GetDepen() && (value.length()>0)) {
65  bool ok = false;
66  double zn = value.toDouble(&ok);
67  if (ok) GetDepen()->SetInitValue(zn);
68  else GetDepen()->SetExpression(value.toLatin1().constData());
69  SetWidgetItemText(true);
70  }
71 }
virtual void ExpressionEdt_textChanged(const QString &)
virtual void ParamEdit_textChanged(const QString &)
TObject * Object() const
Definition: QFitItem.h:27
void SetExpression(const char *iExpression)
virtual TGo4FitDependency * GetDepen()
bool fbFillWidget
Definition: QFitWidget.h:63
void SetParameter(const char *iParameter)
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:95
void SetInitValue(Double_t InitValue)
QFitItem * Parent() const
Definition: QFitItem.h:35
virtual TObject * GetObject()
Definition: QFitWidget.cpp:51
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:46
QFitDependencyWidget(QWidget *parent=0, const char *name=0)