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

Description

The JobRealTimeWidget class provides tuning of sample parameters in real time. Located on the right side of JobView and is visible when realtime activity is selected.

Definition at line 27 of file JobRealTimeWidget.h.

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

Public Slots

void setItem (JobItem *jobItem)
 

Public Member Functions

 JobRealTimeWidget (JobModel *jobModel, QWidget *parent=nullptr)
 
QSize minimumSizeHint () const override
 
ParameterTuningWidgetparameterTuningWidget (JobItem *jobItem)
 
QSize sizeHint () const override
 

Private Member Functions

bool isValidJobItem (JobItem *item)
 Returns true if JobItem is valid for real time simulation. More...
 

Private Attributes

ItemStackPresenter< ParameterTuningWidget > * m_stackedWidget
 

Constructor & Destructor Documentation

◆ JobRealTimeWidget()

JobRealTimeWidget::JobRealTimeWidget ( JobModel jobModel,
QWidget *  parent = nullptr 
)

Definition at line 27 of file JobRealTimeWidget.cpp.

28  : QWidget(parent)
30 {
32  setObjectName("JobRealTimeWidget");
33  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
34 
35  auto* mainLayout = new QVBoxLayout;
36  mainLayout->setMargin(0);
37  mainLayout->setSpacing(0);
38  mainLayout->addWidget(m_stackedWidget);
39  setLayout(mainLayout);
40 
41  m_stackedWidget->setModel(jobModel);
42 }
void setModel(SessionModel *model)
ItemStackPresenter< ParameterTuningWidget > * m_stackedWidget
const QString JobRealTimeWidgetName

References GUI::Constants::JobRealTimeWidgetName, m_stackedWidget, and ItemStackWidget::setModel().

Here is the call graph for this function:

Member Function Documentation

◆ isValidJobItem()

bool JobRealTimeWidget::isValidJobItem ( JobItem item)
private

Returns true if JobItem is valid for real time simulation.

Definition at line 70 of file JobRealTimeWidget.cpp.

71 {
72  return item && (item->isCompleted() || item->isCanceled() || item->isFailed());
73 }
bool isFailed() const
Definition: JobItem.cpp:144
bool isCompleted() const
Definition: JobItem.cpp:134
bool isCanceled() const
Definition: JobItem.cpp:139

References JobItem::isCanceled(), JobItem::isCompleted(), and JobItem::isFailed().

Referenced by setItem().

Here is the call graph for this function:

◆ minimumSizeHint()

QSize JobRealTimeWidget::minimumSizeHint ( ) const
override

Definition at line 54 of file JobRealTimeWidget.cpp.

55 {
56  return QSize(100, 100);
57 }

◆ parameterTuningWidget()

ParameterTuningWidget * JobRealTimeWidget::parameterTuningWidget ( JobItem jobItem)

Definition at line 44 of file JobRealTimeWidget.cpp.

45 {
46  return m_stackedWidget->itemWidget(jobItem);
47 }
T * itemWidget(SessionItem *item)

References ItemStackPresenter< T >::itemWidget(), and m_stackedWidget.

Referenced by FitActivityPanel::setItem().

Here is the call graph for this function:

◆ setItem

void JobRealTimeWidget::setItem ( JobItem jobItem)
slot

Definition at line 59 of file JobRealTimeWidget.cpp.

60 {
61  if (!isValidJobItem(jobItem)) {
63  return;
64  }
65  m_stackedWidget->setItem(jobItem);
66 }
void setItem(U *item, bool *isNew=nullptr)
Shows the widget for given item (and hides previous one). If no widget yet exists,...
bool isValidJobItem(JobItem *item)
Returns true if JobItem is valid for real time simulation.

References ItemStackPresenter< T >::hideWidgets(), isValidJobItem(), m_stackedWidget, and ItemStackPresenter< T >::setItem().

Referenced by JobView::onSelectionChanged().

Here is the call graph for this function:

◆ sizeHint()

QSize JobRealTimeWidget::sizeHint ( ) const
override

Definition at line 49 of file JobRealTimeWidget.cpp.

50 {
52 }
const unsigned int REALTIME_WIDGET_WIDTH_HINT

References GUI::Constants::REALTIME_WIDGET_WIDTH_HINT.

Member Data Documentation

◆ m_stackedWidget

ItemStackPresenter<ParameterTuningWidget>* JobRealTimeWidget::m_stackedWidget
private

Definition at line 43 of file JobRealTimeWidget.h.

Referenced by JobRealTimeWidget(), parameterTuningWidget(), and setItem().


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