BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobSelectorWidget.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Job/JobSelectorWidget.cpp
6 //! @brief Implements class JobSelectorWidget
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 "Base/Util/Assert.h"
17 #include "GUI/Model/Job/JobItem.h"
21 #include <QSplitter>
22 #include <QVBoxLayout>
23 
25  : QWidget(parent)
26  , m_jobModel(jobModel)
27 {
29  setObjectName("JobSelectorWidget");
30 
31  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
32 
33  auto* layout = new QVBoxLayout(this);
34  layout->setMargin(0);
35  layout->setSpacing(0);
36  layout->setContentsMargins(0, 0, 0, 0);
37 
38  auto* splitter = new QSplitter(Qt::Vertical, this);
39  splitter->setChildrenCollapsible(true);
40  layout->addWidget(splitter);
41 
42  m_jobListView = new JobListView(m_jobModel, splitter);
43  splitter->addWidget(m_jobListView);
44 
46  splitter->addWidget(m_jobProperties);
47 
52 
54 }
55 
56 QVector<JobItem*> JobSelectorWidget::selectedJobs() const
57 {
58  return m_jobListView->selectedJobs();
59 }
60 
62 {
63  ASSERT(item);
64  m_jobListView->selectJob(item);
65 }
66 
67 
68 void JobSelectorWidget::onSelectedJobsChanged(const QVector<JobItem*>& jobs)
69 {
70  if (jobs.size() == 1)
71  m_jobProperties->setItem(jobs.front());
72  else
73  m_jobProperties->setItem(nullptr);
74 }
Defines class JobItem.
Defines class JobListView.
Defines class JobPropertiesWidget.
Defines class JobSelectorWidget.
List of jobs on the top left side of JobView.
Definition: JobListView.h:30
QVector< JobItem * > selectedJobs() const
void selectedJobsChanged(const QVector< JobItem * > &jobs)
void selectJob(JobItem *job)
The JobPropertiesWidget class holds component editor for JobItem. Part of JobSelectorWidget,...
void setItem(JobItem *item)
void onSelectedJobsChanged(const QVector< JobItem * > &jobs)
JobListView * m_jobListView
void makeJobItemSelected(JobItem *)
JobPropertiesWidget * m_jobProperties
void selectedJobsChanged(const QVector< JobItem * > &jobs)
JobSelectorWidget(JobModel *jobModel, QWidget *parent=nullptr)
QVector< JobItem * > selectedJobs() const
Defines namespace GUI::Constants.
const QString JobSelectorWidgetName