BornAgain  1.19.0
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/coregui/Views/FitWidgets/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), m_histPlot(new HistogramPlot)
22 {
23  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
24 
25  auto layout = new QVBoxLayout;
26  layout->setContentsMargins(0, 0, 0, 0);
27  layout->addWidget(m_histPlot);
28 
29  setStyleSheet("background-color:white;");
30  setLayout(layout);
31 }
32 
34 {
36  [this](const QString& name) {
39  double chi = fitSuiteItem()->getItemValue(FitSuiteItem::P_CHI2).toDouble();
40  if (iter == 1)
42  m_histPlot->addData(static_cast<double>(iter), chi);
43  }
44  },
45  this);
46 }
47 
49 {
51  m_x.clear();
52  m_y.clear();
53 }
54 
56 {
57  return dynamic_cast<FitSuiteItem*>(currentItem());
58 }
Defines class FitFlowWidget.
Defines class FitSuiteItem.
Defines class HistogramPlot.
void subscribeToItem()
FitFlowWidget(QWidget *parent=nullptr)
QVector< double > m_x
Definition: FitFlowWidget.h:39
FitSuiteItem * fitSuiteItem()
HistogramPlot * m_histPlot
Definition: FitFlowWidget.h:38
void unsubscribeFromItem()
QVector< double > m_y
Definition: FitFlowWidget.h:40
static const QString P_CHI2
Definition: FitSuiteItem.h:28
static const QString P_ITERATION_COUNT
Definition: FitSuiteItem.h:27
void addData(double x, double y)
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
Definition: ModelMapper.cpp:35
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:21