BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitFlowWidget Class Reference

Description

The FitFlowWidget class is intended for showing chi2 .vs interation count dependency. The main goal is to fill vacant place in FitComparisonWidget.

Definition at line 26 of file FitFlowWidget.h.

Inheritance diagram for FitFlowWidget:
[legend]
Collaboration diagram for FitFlowWidget:
[legend]

Public Member Functions

 FitFlowWidget (QWidget *parent=nullptr)
 
virtual QList< QAction * > actionList ()
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual void setItem (SessionItem *item)
 

Protected Member Functions

void hideEvent (QHideEvent *) override
 
void showEvent (QShowEvent *) override
 
void subscribeToItem () override
 
void unsubscribeFromItem () override
 

Private Member Functions

FitSuiteItemfitSuiteItem ()
 

Private Attributes

HistogramPlotm_histPlot
 
SessionItemControllerm_itemController
 
QVector< double > m_x
 
QVector< double > m_y
 

Constructor & Destructor Documentation

◆ FitFlowWidget()

FitFlowWidget::FitFlowWidget ( QWidget *  parent = nullptr)
explicit

Definition at line 20 of file FitFlowWidget.cpp.

21  : SessionItemWidget(parent)
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 }
HistogramPlot * m_histPlot
Definition: FitFlowWidget.h:38
SessionItemWidget(QWidget *parent=nullptr)

References m_histPlot.

Member Function Documentation

◆ actionList()

QList< QAction * > SessionItemWidget::actionList ( )
virtualinherited

◆ currentItem() [1/2]

◆ currentItem() [2/2]

const SessionItem * SessionItemWidget::currentItem ( ) const
inherited

Definition at line 46 of file SessionItemWidget.cpp.

47 {
48  return m_itemController->currentItem();
49 }
SessionItemController * m_itemController

References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.

Here is the call graph for this function:

◆ fitSuiteItem()

FitSuiteItem * FitFlowWidget::fitSuiteItem ( )
private

Definition at line 56 of file FitFlowWidget.cpp.

57 {
58  return dynamic_cast<FitSuiteItem*>(currentItem());
59 }

References SessionItemWidget::currentItem().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
overrideprotectedinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item de...

References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().

Here is the call graph for this function:

◆ setItem()

◆ showEvent()

void SessionItemWidget::showEvent ( QShowEvent *  )
overrideprotectedinherited

Definition at line 51 of file SessionItemWidget.cpp.

52 {
54 }

References SessionItemWidget::m_itemController, and SessionItemController::subscribe().

Here is the call graph for this function:

◆ subscribeToItem()

void FitFlowWidget::subscribeToItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 34 of file FitFlowWidget.cpp.

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 }
FitSuiteItem * fitSuiteItem()
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
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:20

References HistogramPlot::addData(), FitSuiteItem::chi2(), HistogramPlot::clearData(), fitSuiteItem(), FitSuiteItem::isIterationCountPropertyName(), FitSuiteItem::iterationCount(), m_histPlot, SessionItem::mapper(), GUI::RealSpace::Particles::name(), and ModelMapper::setOnPropertyChange().

Here is the call graph for this function:

◆ unsubscribeFromItem()

void FitFlowWidget::unsubscribeFromItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 49 of file FitFlowWidget.cpp.

50 {
52  m_x.clear();
53  m_y.clear();
54 }
QVector< double > m_x
Definition: FitFlowWidget.h:39
QVector< double > m_y
Definition: FitFlowWidget.h:40

References HistogramPlot::clearData(), m_histPlot, m_x, and m_y.

Here is the call graph for this function:

Member Data Documentation

◆ m_histPlot

HistogramPlot* FitFlowWidget::m_histPlot
private

Definition at line 38 of file FitFlowWidget.h.

Referenced by FitFlowWidget(), subscribeToItem(), and unsubscribeFromItem().

◆ m_itemController

◆ m_x

QVector<double> FitFlowWidget::m_x
private

Definition at line 39 of file FitFlowWidget.h.

Referenced by unsubscribeFromItem().

◆ m_y

QVector<double> FitFlowWidget::m_y
private

Definition at line 40 of file FitFlowWidget.h.

Referenced by unsubscribeFromItem().


The documentation for this class was generated from the following files: