BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitActivityPanel.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Fit/FitActivityPanel.cpp
6 //! @brief Implements class FitActivityPanel
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 
16 #include "GUI/Model/Job/JobItem.h"
24 #include <QLabel>
25 #include <QPushButton>
26 #include <QStackedWidget>
27 #include <QVBoxLayout>
28 
30  : QWidget(parent)
31  , m_realTimeWidget(nullptr)
32  , m_fitSessionManager(new FitSessionManager(this))
33 {
34  setWindowTitle(GUI::Constants::JobFitPanelName);
35  setObjectName("FitActivityPanel");
36  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
37 
38  auto* layout = new QVBoxLayout(this);
39  layout->setMargin(0);
40  layout->setSpacing(0);
41  m_stack = new QStackedWidget(this);
42  layout->addWidget(m_stack);
43 
44  m_blankWidget = new QWidget(m_stack);
45  m_stack->addWidget(m_blankWidget);
46 
47  m_nofitLabel = new QLabel("Job has no real data linked to it for fitting.", m_stack);
48  m_nofitLabel->setAlignment(Qt::AlignCenter);
49  m_stack->addWidget(m_nofitLabel);
50 
52  m_stack->addWidget(m_fitSessionWidget);
53 }
54 
56 {
57  ASSERT(realTimeWidget);
58  m_realTimeWidget = realTimeWidget;
59 }
60 
62 {
65 }
66 
68 {
69  return QSize(80, 80);
70 }
71 
73 {
74  if (!isValidJobItem(item)) {
75  if (!item)
76  m_stack->setCurrentWidget(m_blankWidget);
77  else
78  m_stack->setCurrentWidget(m_nofitLabel);
79  emit showLog(nullptr);
80  return;
81  }
82 
83  m_stack->setCurrentWidget(m_fitSessionWidget);
88  emit showLog(controller->fitLog());
89 }
90 
92 {
93  return item ? item->isValidForFitting() : false;
94 }
95 
97 {
98  return m_fitSessionWidget;
99 }
Defines class FitActivityPanel.
Defines class FitSessionController.
Defines class FitSessionManager.
Defines class FitSessionWidget.
Defines class JobItem.
Defines class JobModel.
Defines class JobRealTimeWidget.
Defines class RunFitControlWidget.
QSize minimumSizeHint() const override
FitSessionWidget * m_fitSessionWidget
FitActivityPanel(QWidget *parent=nullptr)
bool isValidJobItem(JobItem *item)
void showLog(FitLog *log)
QWidget * m_blankWidget
QSize sizeHint() const override
QStackedWidget * m_stack
FitSessionWidget * currentFitSuiteWidget()
void setRealTimeWidget(JobRealTimeWidget *realTimeWidget)
void setItem(JobItem *item)
JobRealTimeWidget * m_realTimeWidget
FitSessionManager * m_fitSessionManager
Controls all activity related to the single fitting task for JobItem. Provides interaction between Fi...
Handles all activity related to the simultaneous running of fitting jobs.
FitSessionController * sessionController(JobItem *jobItem)
Contains all fit settings for given JobItem (fit parameters, minimizer settings). Controlled by FitAc...
void setModelTuningWidget(ParameterTuningWidget *tuningWidget)
void setItem(JobItem *jobItem)
void setSessionController(FitSessionController *sessionController)
bool isValidForFitting()
Definition: JobItem.cpp:154
The JobRealTimeWidget class provides tuning of sample parameters in real time. Located on the right s...
ParameterTuningWidget * parameterTuningWidget(JobItem *jobItem)
Defines namespace GUI::Constants.
const unsigned int REALTIME_WIDGET_WIDTH_HINT
const unsigned int FIT_ACTIVITY_PANEL_HEIGHT
const QString JobFitPanelName