BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitFlowWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotComparison/FitFlowWidget.cpp
6 //! @brief Implement class FitFlowWidget
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
18 #include <QVBoxLayout>
19 
21  : SessionItemWidget(parent)
22  , m_histPlot(new HistogramPlot)
23 {
24  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
25 
26  auto* layout = new QVBoxLayout;
27  layout->setContentsMargins(0, 0, 0, 0);
28  layout->addWidget(m_histPlot);
29 
30  setStyleSheet("background-color:white;");
31  setLayout(layout);
32 }
33 
35 {
37  [this](const QString& name) {
39  int iter = fitSuiteItem()->iterationCount();
40  double chi = fitSuiteItem()->chi2();
41  if (iter == 1)
43  m_histPlot->addData(static_cast<double>(iter), chi);
44  }
45  },
46  this);
47 }
48 
50 {
52  m_x.clear();
53  m_y.clear();
54 }
55 
57 {
58  return dynamic_cast<FitSuiteItem*>(currentItem());
59 }
Defines class FitFlowWidget.
Defines class FitSuiteItem.
Defines class HistogramPlot.
FitFlowWidget(QWidget *parent=nullptr)
QVector< double > m_x
Definition: FitFlowWidget.h:39
FitSuiteItem * fitSuiteItem()
HistogramPlot * m_histPlot
Definition: FitFlowWidget.h:38
void unsubscribeFromItem() override
QVector< double > m_y
Definition: FitFlowWidget.h:40
void subscribeToItem() override
double chi2() const
int iterationCount() const
static bool isIterationCountPropertyName(const QString &name)
void addData(double x, double y)
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=nullptr)
Definition: ModelMapper.cpp:39
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....
SessionItem * currentItem()
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:20