GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitMinuitWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitMinuitWidget.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 "QFitMinuitWidget.h"
15 
16 #include "Riostream.h"
17 
18 #include "TGo4FitMinuit.h"
19 
20 QFitMinuitWidget::QFitMinuitWidget(QWidget *parent, const char* name)
21  : QFitNamedWidget(parent, name)
22 {
23  setupUi(this);
24 }
25 
27  return dynamic_cast<TGo4FitMinuit*> (GetObject());
28 }
29 
32  TGo4FitMinuit* minuit = GetMinuit();
33  if (minuit) {
34  QString cmds;
35  char s[3]; s[0] = 13; s[1] = 10; s[2]=0;
36  for(int i=0;i<minuit->GetNumCommands();i++) {
37  cmds+=minuit->GetCommand(i);
38  if (i<minuit->GetNumCommands()-1) cmds+=s;
39  }
40  CommandsEdit->setText(cmds);
41  } else CommandsEdit->setText("");
42 }
43 
44 
46 {
47  TGo4FitMinuit* minuit = GetMinuit();
48  if (minuit==0) return;
49 
50  minuit->ClearCommands();
51 
52  QTextCursor curs(CommandsEdit->document());
53  while (!curs.atEnd()) {
54  curs.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
55  minuit->AddCommand(curs.selectedText().toLatin1().constData());
56  curs.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor);
57  }
58 }
virtual TGo4FitMinuit * GetMinuit()
void ClearCommands()
Definition: TGo4FitMinuit.h:86
void AddCommand(const char *iCommand)
Int_t GetNumCommands()
Definition: TGo4FitMinuit.h:76
const char * GetCommand(Int_t n)
virtual void FillSpecificData()
virtual void CommandsEdit_textChanged()
virtual TObject * GetObject()
Definition: QFitWidget.cpp:53
virtual void FillSpecificData()
QFitMinuitWidget(QWidget *parent=0, const char *name=0)