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

Description

The FitComparisonWidget class plots realdata, simulated data and relative difference map during the course of the fit.

Definition at line 32 of file FitComparisonWidget1D.h.

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

Public Member Functions

 FitComparisonWidget1D (QWidget *parent=nullptr)
 
 ~FitComparisonWidget1D () override
 
QList< QAction * > actionList () override
 
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 Slots

void onResetViewAction ()
 

Private Member Functions

JobItemjobItem ()
 
Data1DViewItemviewItem ()
 

Private Attributes

FitComparison1DViewControllerm_comparisonController
 
Plot1DCanvasm_data_plot
 
Plot1DCanvasm_diff_plot
 
FitFlowWidgetm_fitFlowWidget
 
SessionItemControllerm_itemController
 
SpecularDataPropertyWidgetm_propertyWidget
 
QAction * m_resetViewAction
 
PlotStatusLabelm_statusLabel
 
QAction * m_togglePropertiesAction
 

Constructor & Destructor Documentation

◆ FitComparisonWidget1D()

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

Definition at line 31 of file FitComparisonWidget1D.cpp.

32  : SessionItemWidget(parent)
36  , m_statusLabel(new PlotStatusLabel(nullptr, this))
38  , m_resetViewAction(new QAction(this))
40 {
41  m_propertyWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
42 
43  auto* vlayout = new QVBoxLayout;
44  vlayout->setMargin(0);
45  vlayout->setSpacing(0);
46 
47  auto* gridLayout = new QGridLayout;
48  gridLayout->setMargin(0);
49  gridLayout->setSpacing(0);
50 
51  gridLayout->addWidget(m_data_plot, 0, 0, 1, -1);
52  gridLayout->addWidget(m_diff_plot, 1, 0, 1, 2);
53  gridLayout->addWidget(m_fitFlowWidget, 1, 2, 1, 1);
54 
55  vlayout->addLayout(gridLayout);
56  vlayout->addWidget(m_statusLabel);
57 
58  auto* hlayout = new QHBoxLayout;
59  hlayout->setMargin(0);
60  hlayout->setSpacing(0);
61  hlayout->addLayout(vlayout);
62  hlayout->addWidget(m_propertyWidget);
63  setLayout(hlayout);
64 
65  m_resetViewAction->setText("Center view");
66  m_resetViewAction->setIcon(QIcon(":/images/camera-metering-center.svg"));
67  m_resetViewAction->setToolTip("Reset View");
68  connect(m_resetViewAction, &QAction::triggered, this,
70 
73 
74  m_propertyWidget->setVisible(false);
75 }
static QAction * createTogglePropertiesPanelAction(QObject *parent, QWidget *toggledWidget=nullptr)
Create "toggle properties panel" action.
FitComparison1DViewController * m_comparisonController
FitFlowWidget * m_fitFlowWidget
PlotStatusLabel * m_statusLabel
SpecularDataPropertyWidget * m_propertyWidget
The FitFlowWidget class is intended for showing chi2 .vs interation count dependency....
Definition: FitFlowWidget.h:26
The Plot1DCanvas class contains SpecularPlotWithDataView for specular data presentation,...
Definition: Plot1DCanvas.h:29
The PlotStatusLabel class shows status string as reported by DescriptedPlot in a frame....
SessionItemWidget(QWidget *parent=nullptr)
Widget to edit properties of a SpecularDataItem or a Data1DViewItem.

References ActionFactory::createTogglePropertiesPanelAction(), m_data_plot, m_diff_plot, m_fitFlowWidget, m_propertyWidget, m_resetViewAction, m_statusLabel, m_togglePropertiesAction, and onResetViewAction().

Here is the call graph for this function:

◆ ~FitComparisonWidget1D()

FitComparisonWidget1D::~FitComparisonWidget1D ( )
overridedefault

Member Function Documentation

◆ actionList()

QList< QAction * > FitComparisonWidget1D::actionList ( )
overridevirtual

Reimplemented from SessionItemWidget.

Definition at line 79 of file FitComparisonWidget1D.cpp.

80 {
81  return QList<QAction*>() << m_resetViewAction << m_togglePropertiesAction;
82 }

References m_resetViewAction, and m_togglePropertiesAction.

◆ 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:

◆ 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:

◆ jobItem()

JobItem * FitComparisonWidget1D::jobItem ( )
private

Definition at line 119 of file FitComparisonWidget1D.cpp.

120 {
121  auto* jobItem = dynamic_cast<JobItem*>(currentItem());
122  return jobItem;
123 }

References SessionItemWidget::currentItem().

Referenced by subscribeToItem(), and viewItem().

Here is the call graph for this function:

◆ onResetViewAction

void FitComparisonWidget1D::onResetViewAction ( )
privateslot

Definition at line 113 of file FitComparisonWidget1D.cpp.

114 {
115  viewItem()->resetView();
117 }
void resetView()
Set axes viewport to original data.

References m_comparisonController, FitComparison1DViewController::resetDiffView(), Data1DViewItem::resetView(), and viewItem().

Referenced by FitComparisonWidget1D(), and subscribeToItem().

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 FitComparisonWidget1D::subscribeToItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 84 of file FitComparisonWidget1D.cpp.

85 {
86  if (!jobItem()->isValidForFitting())
87  return;
88 
89  connect(jobItem(), &JobItem::jobStatusChanged, this, [=](const JobStatus) {
90  if (jobItem()->isCompleted())
92  });
93 
95 
98  m_fitFlowWidget->setItem(jobItem()->fitSuiteItem());
99 
100  m_statusLabel->reset();
103 
105 }
JobStatus
The JobStatus enum lists the possible states of a job.
Definition: JobStatus.h:22
void jobStatusChanged(const JobStatus status)
Plot1D * plot1D()
void setItem(SessionItem *dataItemView) override
void reset()
Disconnects all color maps from the label.
void addPlot(ScientificPlot *plot)
virtual void setItem(SessionItem *item)
void setItem(SpecularDataItem *item)

References PlotStatusLabel::addPlot(), FitComparison1DViewController::diffItemView(), jobItem(), JobItem::jobStatusChanged(), m_comparisonController, m_data_plot, m_diff_plot, m_fitFlowWidget, m_propertyWidget, m_statusLabel, onResetViewAction(), Plot1DCanvas::plot1D(), PlotStatusLabel::reset(), FitComparison1DViewController::setItem(), Plot1DCanvas::setItem(), SessionItemWidget::setItem(), SpecularDataPropertyWidget::setItem(), and viewItem().

Here is the call graph for this function:

◆ unsubscribeFromItem()

void FitComparisonWidget1D::unsubscribeFromItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 107 of file FitComparisonWidget1D.cpp.

References FitComparison1DViewController::clear(), m_comparisonController, m_diff_plot, and Plot1DCanvas::setItem().

Here is the call graph for this function:

◆ viewItem()

Data1DViewItem * FitComparisonWidget1D::viewItem ( )
private

Definition at line 125 of file FitComparisonWidget1D.cpp.

126 {
127  auto* view_item = dynamic_cast<Data1DViewItem*>(jobItem()->dataItemView());
128  ASSERT(view_item);
129  return view_item;
130 }
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
Data1DViewItem * dataItemView()
Definition: JobItem.cpp:305

References JobItem::dataItemView(), and jobItem().

Referenced by onResetViewAction(), and subscribeToItem().

Here is the call graph for this function:

Member Data Documentation

◆ m_comparisonController

FitComparison1DViewController* FitComparisonWidget1D::m_comparisonController
private

Definition at line 59 of file FitComparisonWidget1D.h.

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

◆ m_data_plot

Plot1DCanvas* FitComparisonWidget1D::m_data_plot
private

Definition at line 51 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and subscribeToItem().

◆ m_diff_plot

Plot1DCanvas* FitComparisonWidget1D::m_diff_plot
private

◆ m_fitFlowWidget

FitFlowWidget* FitComparisonWidget1D::m_fitFlowWidget
private

Definition at line 53 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and subscribeToItem().

◆ m_itemController

◆ m_propertyWidget

SpecularDataPropertyWidget* FitComparisonWidget1D::m_propertyWidget
private

Definition at line 55 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and subscribeToItem().

◆ m_resetViewAction

QAction* FitComparisonWidget1D::m_resetViewAction
private

Definition at line 57 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and actionList().

◆ m_statusLabel

PlotStatusLabel* FitComparisonWidget1D::m_statusLabel
private

Definition at line 54 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and subscribeToItem().

◆ m_togglePropertiesAction

QAction* FitComparisonWidget1D::m_togglePropertiesAction
private

Definition at line 58 of file FitComparisonWidget1D.h.

Referenced by FitComparisonWidget1D(), and actionList().


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