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