00001 // $Id: QFitMinuitWidget.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 "QFitMinuitWidget.h" 00015 00016 #include "Riostream.h" 00017 00018 #include "TGo4FitMinuit.h" 00019 00020 QFitMinuitWidget::QFitMinuitWidget(QWidget *parent, const char* name) 00021 : QFitNamedWidget(parent, name) 00022 { 00023 setupUi(this); 00024 } 00025 00026 TGo4FitMinuit * QFitMinuitWidget::GetMinuit() { 00027 return dynamic_cast<TGo4FitMinuit*> (GetObject()); 00028 } 00029 00030 void QFitMinuitWidget::FillSpecificData() { 00031 QFitNamedWidget::FillSpecificData(); 00032 TGo4FitMinuit* minuit = GetMinuit(); 00033 if (minuit) { 00034 QString cmds; 00035 char s[3]; s[0] = 13; s[1] = 10; s[2]=0; 00036 for(int i=0;i<minuit->GetNumCommands();i++) { 00037 cmds+=minuit->GetCommand(i); 00038 if (i<minuit->GetNumCommands()-1) cmds+=s; 00039 } 00040 CommandsEdit->setText(cmds); 00041 } else CommandsEdit->setText(""); 00042 } 00043 00044 00045 void QFitMinuitWidget::CommandsEdit_textChanged() 00046 { 00047 TGo4FitMinuit* minuit = GetMinuit(); 00048 if (minuit==0) return; 00049 00050 minuit->ClearCommands(); 00051 00052 QTextCursor curs(CommandsEdit->document()); 00053 while (!curs.atEnd()) { 00054 curs.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor); 00055 minuit->AddCommand(curs.selectedText().toLatin1().constData()); 00056 curs.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor); 00057 } 00058 }