BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobListModel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Job/JobListModel.h
6 //! @brief Defines class JobListModel
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 
15 #ifndef BORNAGAIN_GUI_VIEW_JOB_JOBLISTMODEL_H
16 #define BORNAGAIN_GUI_VIEW_JOB_JOBLISTMODEL_H
17 
18 #include <QAbstractListModel>
19 
20 class JobItem;
21 class JobModel;
22 
23 class JobListModel : public QAbstractListModel {
24  Q_OBJECT
25 
26 public:
27  JobListModel(JobModel* jobs, QObject* parent = nullptr);
28  ~JobListModel() override;
29 
30  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
31 
32  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
33 
34  JobItem* jobForIndex(const QModelIndex& index) const;
35  QModelIndex indexForJob(JobItem* job);
36 
37  void runJob(const QModelIndex& index);
38  void removeJob(const QModelIndex& index);
39  void cancelJob(const QModelIndex& index);
40 
41 private slots:
43  void onRowsAboutToBeInserted(const QModelIndex& parent, int start, int end);
44  void onRowsInserted(const QModelIndex& parent, int start, int end);
45 
46 private:
47  void enableJobNotification(JobItem* job);
49 
50 private:
52 };
53 
54 #endif // BORNAGAIN_GUI_VIEW_JOB_JOBLISTMODEL_H
void removeJob(const QModelIndex &index)
void disableJobNotification(JobItem *job)
JobListModel(JobModel *jobs, QObject *parent=nullptr)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void cancelJob(const QModelIndex &index)
QModelIndex indexForJob(JobItem *job)
void onRowsInserted(const QModelIndex &parent, int start, int end)
void emitJobListModelChanged(JobItem *job)
JobItem * jobForIndex(const QModelIndex &index) const
JobModel * m_jobs
Definition: JobListModel.h:51
void enableJobNotification(JobItem *job)
void onRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
void runJob(const QModelIndex &index)
~JobListModel() override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override