GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QFitRangeWidget.cpp
Go to the documentation of this file.
1 // $Id: QFitRangeWidget.cpp 3116 2021-03-30 06:51:49Z 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 "QFitRangeWidget.h"
15 
16 #include "QFitItem.h"
17 #include "TGo4FitComponent.h"
18 
19 QFitRangeWidget::QFitRangeWidget(QWidget *parent, const char* name)
20  : QFitWidget(parent, name)
21 {
22  setupUi(this);
23  QObject::connect(AxisNumSpin, SIGNAL(valueChanged(int)), this, SLOT(AxisNumSpin_valueChanged(int)));
24  QObject::connect(RangeTypCmb, SIGNAL(activated(int)), this, SLOT(RangeTypCmb_activated(int)));
25  QObject::connect(LeftEdt, SIGNAL(textChanged(QString)), this, SLOT(LeftEdt_textChanged(QString)));
26  QObject::connect(RightEdt, SIGNAL(textChanged(QString)), this, SLOT(RightEdt_textChanged(QString)));
27 }
28 
30 {
31  return dynamic_cast<TGo4FitComponent*> (GetObject());
32 }
33 
35 {
36  return GetItem()->Tag();
37 }
38 
40 {
41  int num = GetNumRange();
42  if ((num<0) || (GetComp()==0)) return;
43 
44  Int_t typ, naxis;
45  Double_t left, right;
46  GetComp()->GetRangeCondition(num,typ,naxis,left,right);
47 
48  RangeTypCmb->setCurrentIndex(typ);
49  AxisNumSpin->setValue(naxis);
50 
51  if (typ!=3) LeftEdt->setText(QString::number(left));
52  if (typ!=2) RightEdt->setText(QString::number(right));
53 
55 }
56 
58 {
59  LeftEdt->setEnabled((num==0) || (num==1) || (num==2));
60  RightEdt->setEnabled((num==0) || (num==1) || (num==3));
61 }
62 
64 {
65  if (fbFillWidget || (GetComp()==0)) return;
66 
67  int num = GetNumRange();
68  if(num<0) return;
69 
70  Int_t typ = RangeTypCmb->currentIndex();
71  Int_t naxis = AxisNumSpin->value();
72 
73  Double_t left=0., right=0.;
74  bool isok1 = true, isok2 = true;
75 
76  if (typ!=3) left = LeftEdt->text().toDouble(&isok1);
77  if (typ!=2) right = RightEdt->text().toDouble(&isok2);
78 
79  if (isok1 && isok2) {
80  GetComp()->SetRangeCondition(num,typ,naxis,left,right);
81  SetWidgetItemText(true);
82  }
83 }
84 
86 {
87  GetRangeData();
88 }
89 
91 {
92  if (!fbFillWidget) {
94  GetRangeData();
95  }
96 }
97 
98 void QFitRangeWidget::LeftEdt_textChanged( const QString & )
99 {
100  GetRangeData();
101 }
102 
104 {
105  GetRangeData();
106 }
void SetRangeCondition(Int_t n, Int_t typ, Int_t naxis, Double_t left, Double_t right)
QFitRangeWidget(QWidget *parent=0, const char *name=0)
virtual void LeftEdt_textChanged(const QString &)
virtual void EnableEditsForRangeType(int)
bool fbFillWidget
Definition: QFitWidget.h:63
virtual void AxisNumSpin_valueChanged(int)
virtual void SetWidgetItemText(bool trace)
Definition: QFitWidget.cpp:95
virtual int GetNumRange()
virtual void RangeTypCmb_activated(int)
virtual TGo4FitComponent * GetComp()
virtual TObject * GetObject()
Definition: QFitWidget.cpp:51
void GetRangeCondition(Int_t n, Int_t &typ, Int_t &naxis, Double_t &left, Double_t &right) const
virtual void FillSpecificData()
virtual void GetRangeData()
virtual void RightEdt_textChanged(const QString &)
virtual QFitItem * GetItem()
Definition: QFitWidget.cpp:46
int Tag() const
Definition: QFitItem.h:33