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