BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
JobSelectorActions.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/JobWidgets/JobSelectorActions.h
6 //! @brief Defines class JobSelectorActions
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_COREGUI_VIEWS_JOBWIDGETS_JOBSELECTORACTIONS_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_JOBWIDGETS_JOBSELECTORACTIONS_H
17 
18 #include <QModelIndex>
19 #include <QObject>
20 
21 class QAction;
22 class JobModel;
23 class QItemSelectionModel;
24 class QModelIndex;
25 class QMenu;
26 
27 //! The JobSelectorActions class contains actions to run/remove jobs. Actions are used by the
28 //! toolbar and JobSelectorList's context menu.
29 
30 class JobSelectorActions : public QObject {
31  Q_OBJECT
32 public:
33  JobSelectorActions(JobModel* jobModel, QObject* parent = 0);
34 
35  void setSelectionModel(QItemSelectionModel* selectionModel);
36 
37 public slots:
38  void onRunJob();
39  void onRemoveJob();
40  void onContextMenuRequest(const QPoint& point, const QModelIndex& indexAtPoint = {});
41  void equalizeSelectedToJob(int selected_id);
42 
43 private:
44  void initItemContextMenu(QMenu& menu, const QModelIndex& indexAtPoint);
45  void setupEqualizeMenu(QMenu& menu);
46  void setAllActionsEnabled(bool value);
47  bool canRunJob(const QModelIndex& index) const;
48  bool canRemoveJob(const QModelIndex& index) const;
49 
50  QAction* m_runJobAction;
52  QItemSelectionModel* m_selectionModel;
54 };
55 
56 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_JOBWIDGETS_JOBSELECTORACTIONS_H
The JobSelectorActions class contains actions to run/remove jobs.
void onContextMenuRequest(const QPoint &point, const QModelIndex &indexAtPoint={})
Generates context menu at given point.
void setupEqualizeMenu(QMenu &menu)
void initItemContextMenu(QMenu &menu, const QModelIndex &indexAtPoint)
JobSelectorActions(JobModel *jobModel, QObject *parent=0)
void equalizeSelectedToJob(int selected_id)
Puts all IntensityDataItem axes range to the selected job.
void setAllActionsEnabled(bool value)
QItemSelectionModel * m_selectionModel
void setSelectionModel(QItemSelectionModel *selectionModel)
bool canRemoveJob(const QModelIndex &index) const
bool canRunJob(const QModelIndex &index) const