BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskEditorActions.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Mask/MaskEditorActions.h
6 //! @brief Defines class MaskEditorActions
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_MASK_MASKEDITORACTIONS_H
16 #define BORNAGAIN_GUI_VIEW_MASK_MASKEDITORACTIONS_H
17 
19 #include <QList>
20 #include <QModelIndex>
21 #include <QObject>
22 
23 class QAction;
24 class SessionModel;
25 class QItemSelectionModel;
26 class QMenu;
27 class QMenu;
28 
29 //! Defines actions for MaskEditor which are related to selected MaskItem (toggle mask value,
30 //! lower/rize mask in the stack, delete mask). If more than one MaskItem is selected,
31 //! action will be applied to the whole selection, if possible.
32 
33 class MaskEditorActions : public QObject {
34  Q_OBJECT
35 public:
36  MaskEditorActions(QWidget* parent);
37 
38  void setModel(SessionModel* maskModel, const QModelIndex& rootIndex);
39  void setSelectionModel(QItemSelectionModel* selectionModel);
40 
41  QAction* sendToBackAction();
42  QAction* bringToFrontAction();
43 
44  QList<QAction*> topToolbarActions();
45 
46 signals:
50 
51 public slots:
52  void onItemContextMenuRequest(const QPoint& point);
53  void onDeleteMaskAction();
54 
55 private slots:
57  void onBringToFrontAction();
58  void onSendToBackAction();
59 
60 private:
61  void initItemContextMenu(QMenu& menu);
62  void changeMaskStackingOrder(MaskEditorFlags::Stacking value);
63  bool isBringToFrontPossible() const;
64  bool isSendToBackPossible() const;
65  void setAllActionsEnabled(bool value);
66 
71 
73  QAction* m_savePlotAction;
75 
77  QModelIndex m_rootIndex; //! Index in the model corresponding to IntensityDataItem
78  QItemSelectionModel* m_selectionModel;
79 };
80 
81 #endif // BORNAGAIN_GUI_VIEW_MASK_MASKEDITORACTIONS_H
Defines class MaskEditorFlags.
Defines actions for MaskEditor which are related to selected MaskItem (toggle mask value,...
QItemSelectionModel * m_selectionModel
Index in the model corresponding to IntensityDataItem.
bool isSendToBackPossible() const
Returns true if at least one of MaskItems in the selection can be moved one level down.
QAction * m_toggleMaskValueAction
QList< QAction * > topToolbarActions()
void propertyPanelRequest()
QAction * m_togglePanelAction
void onToggleMaskValueAction()
Performs switch of mask value for all selected items (true -> false, false -> true)
MaskEditorActions(QWidget *parent)
void onItemContextMenuRequest(const QPoint &point)
Constructs MaskItem context menu following the request from MaskGraphicsScene or MaskEditorInfoPanel.
void setAllActionsEnabled(bool value)
QAction * m_bringToFrontAction
QAction * m_sendToBackAction
QAction * m_deleteMaskAction
void setModel(SessionModel *maskModel, const QModelIndex &rootIndex)
void changeMaskStackingOrder(MaskEditorFlags::Stacking value)
Lower mask one level down or rise one level up in the masks stack.
QAction * bringToFrontAction()
QAction * m_savePlotAction
void initItemContextMenu(QMenu &menu)
Init external context menu with currently defined actions. Triggered from MaskGraphicsScene of MaskEd...
QAction * sendToBackAction()
bool isBringToFrontPossible() const
Returns true if at least one of MaskItems in the selection can be moved one level up (Naturally,...
SessionModel * m_maskModel
QAction * m_resetViewAction
void setSelectionModel(QItemSelectionModel *selectionModel)
QModelIndex m_rootIndex
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
Definition: SessionModel.h:42