GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
QFitModelGaussNWidget.cpp
Go to the documentation of this file.
1 // $Id$
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 "QFitModelGaussNWidget.h"
15 
16 #include "TGo4FitModelGaussN.h"
17 #include "TGo4FitGuiTypes.h"
18 
19 QFitModelGaussNWidget::QFitModelGaussNWidget(QWidget *parent, const char *name)
20  : QFitModelWidget(parent, name)
21 {
22  setupUi(this);
23  QObject::connect(AxisNumberSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &QFitModelGaussNWidget::AxisNumberSpin_valueChanged);
24  QObject::connect(AxisTable, &QTableWidget::cellChanged, this, &QFitModelGaussNWidget::AxisTable_valueChanged);
25 }
26 
28 {
29  return dynamic_cast<TGo4FitModelGaussN*> (GetObject());
30 }
31 
33 {
35  if (GetGaussN()) {
36  AxisNumberSpin->setValue(GetGaussN()->GetAxisNumbers());
37  SetAxisTable();
38  }
39 }
40 
42 {
43  if (!GetGaussN()) return;
44  int num = GetGaussN()->GetAxisNumbers();
45  AxisTable->setRowCount(num);
46  for (int n = 0; n < num; n++)
47  AxisTable->setItem(n, 0, new QTableWidgetItem(QString::number(GetGaussN()->GetAxisForIndex(n))));
48 }
49 
51 {
52  if(!fbFillWidget && GetGaussN())
53  if (GetGaussN()->SetAxisNumbers(num)) {
54  SetAxisTable();
56  }
57 }
58 
60 {
61  if(!fbFillWidget && GetGaussN()) {
62  bool ok = false;
63  int value = AxisTable->item(nrow,ncol)->text().toInt(&ok);
64  if(ok) {
65  GetGaussN()->SetAxisForIndex(nrow,value);
66  if (GetGaussN()->ResortIndexes(nrow)) SetAxisTable();
67  }
68  }
69 }
QFitModelGaussNWidget(QWidget *parent=nullptr, const char *name=nullptr)
bool fbFillWidget
Definition: QFitWidget.h:63
void SetAxisForIndex(Int_t indx, Int_t axis)
virtual TGo4FitModelGaussN * GetGaussN()
void FillSpecificData() override
virtual void UpdateItemsOfType(int typ, bool allitems=false)
Definition: QFitWidget.cpp:98
virtual TObject * GetObject()
Definition: QFitWidget.cpp:50
virtual void AxisTable_valueChanged(int, int)
Int_t GetAxisNumbers() const
virtual void AxisNumberSpin_valueChanged(int)