BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
JobOutputDataWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/JobWidgets/JobOutputDataWidget.cpp
6 //! @brief Implements class JobOutputDataWidget
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 
20 #include <QVBoxLayout>
21 
22 namespace {
23 const bool reuse_widget = true;
24 }
25 
27  : QWidget(parent), m_stackedWidget(new ItemStackPresenter<JobResultsPresenter>(reuse_widget))
28 {
29  setWindowTitle(QLatin1String("Job OutputData"));
30  setObjectName("JobOutputDataWidget");
31 
32  setMinimumSize(400, 400);
33  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
34 
35  QVBoxLayout* mainLayout = new QVBoxLayout;
36  mainLayout->setMargin(0);
37  mainLayout->setSpacing(0);
38 
39  mainLayout->addWidget(m_stackedWidget);
40 
41  m_stackedWidget->setMinimumSize(600, 600);
42  m_stackedWidget->setModel(jobModel);
43 
44  setLayout(mainLayout);
45 }
46 
48 {
49  if (!isValidJobItem(jobItem)) {
51  return;
52  }
53 
54  m_stackedWidget->setItem(jobItem);
55 }
56 
58 {
59  if (auto widget = m_stackedWidget->currentWidget())
60  widget->setPresentation(static_cast<JobViewFlags::EActivities>(activity));
61 }
62 
64 {
65  if (!item)
66  return false;
67 
68  // do not show running job items, the rest (canceled, fitted, etc) are shown
69  return !item->isRunning();
70 }
Defines class JobItem.
Defines class JobModel.
Defines class JobOutputDataWidget.
Defines class JobResultsPresenter.
The ItemStackPresenter templated class extends ItemStackWidget so it could operate with SesionItem ed...
void setItem(U *item, bool *isNew=0)
Shows the widget for given item (and hides previous one).
void setModel(SessionModel *model)
bool isRunning() const
Definition: JobItem.cpp:145
JobOutputDataWidget(JobModel *jobModel, QWidget *parent=nullptr)
virtual bool isValidJobItem(JobItem *item)
void onActivityChanged(int activity)
void setItem(JobItem *jobItem)
ItemStackPresenter< JobResultsPresenter > * m_stackedWidget
Presents results of job (JobItem) using stack of different widgets and combo box in the right top cor...
Defines namespace Constants.