00001 // $Id: QFitDependencyWidget.cpp 1134 2014-01-22 14:53:40Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "QFitDependencyWidget.h" 00015 00016 #include "QFitItem.h" 00017 #include "TObjArray.h" 00018 #include "TGo4FitDependency.h" 00019 #include "QFitItem.h" 00020 #include "TObjArray.h" 00021 #include "TGo4FitDependency.h" 00022 00023 QFitDependencyWidget::QFitDependencyWidget(QWidget *parent, const char* name) 00024 : QFitWidget(parent, name) 00025 { 00026 setupUi(this); 00027 } 00028 00029 TGo4FitDependency * QFitDependencyWidget::GetDepen() { 00030 return dynamic_cast<TGo4FitDependency*> (GetObject()); 00031 } 00032 00033 void QFitDependencyWidget::FillSpecificData() { 00034 if(GetDepen()) { 00035 if (GetDepen()->IsResultDepend()) { 00036 TObjArray* lst = dynamic_cast<TObjArray*> (GetItem()->Parent()->Object()); 00037 ParamEdit->setText(QString("Result ")+QString::number(lst->IndexOf(GetObject()))); 00038 ParamEdit->setReadOnly(true); 00039 ParamEdit->setEnabled(false); 00040 } else { 00041 ParamEdit->setText(GetDepen()->GetParameter().Data()); 00042 ParamEdit->setReadOnly(false); 00043 ParamEdit->setEnabled(true); 00044 } 00045 if (GetDepen()->IsInitValue()) ExpressionEdt->setText(QString::number(GetDepen()->GetInitValue())); 00046 else ExpressionEdt->setText(GetDepen()->GetExpression().Data()); 00047 } 00048 } 00049 00050 00051 00052 void QFitDependencyWidget::ParamEdit_textChanged( const QString & param) 00053 { 00054 if(!fbFillWidget && GetDepen() && (param.length()>0)) { 00055 GetDepen()->SetParameter(param.toLatin1().constData()); 00056 SetWidgetItemText(true); 00057 } 00058 } 00059 00060 00061 void QFitDependencyWidget::ExpressionEdt_textChanged( const QString & value) 00062 { 00063 if(!fbFillWidget && GetDepen() && (value.length()>0)) { 00064 bool ok = false; 00065 double zn = value.toDouble(&ok); 00066 if (ok) GetDepen()->SetInitValue(zn); 00067 else GetDepen()->SetExpression(value.toLatin1().constData()); 00068 SetWidgetItemText(true); 00069 } 00070 }