BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ProjectionsEditorCanvas.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Projection/ProjectionsEditorCanvas.h
6 //! @brief Defines class ProjectionsEditorCanvas
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_PROJECTION_PROJECTIONSEDITORCANVAS_H
16 #define BORNAGAIN_GUI_VIEW_PROJECTION_PROJECTIONSEDITORCANVAS_H
17 
19 #include <QModelIndex>
20 #include <QWidget>
21 
22 class MaskGraphicsScene;
23 class MaskGraphicsView;
24 class SessionModel;
25 class IntensityDataItem;
26 class ColorMap;
27 class PlotStatusLabel;
28 class MaskItem;
29 class QItemSelectionModel;
30 
31 //! Holds a graphics scene to draw projections on top of ColorMap. Being a part
32 //! of ProjectionEditor, provides interaction logic between graphics scene and ProjectionsWidget.
33 
34 //! Particularly, it creates temporary ProjectionItem in projection container, when mouse
35 //! is inside ColorMap viewport.
36 
37 class ProjectionsEditorCanvas : public QWidget {
38  Q_OBJECT
39 
40 public:
41  ProjectionsEditorCanvas(QWidget* parent = nullptr);
42 
43  void setContext(SessionModel* model, const QModelIndex& shapeContainerIndex,
44  IntensityDataItem* intensityItem);
45 
46  void resetContext();
47 
48  void setSelectionModel(QItemSelectionModel* model);
49 
51 
52 signals:
53  void changeActivityRequest(MaskEditorFlags::Activity);
55  void marginsChanged(double left, double right);
56 
57 public slots:
58  void onEnteringColorMap();
59  void onLeavingColorMap();
60  void onPositionChanged(double x, double y);
61  void onResetViewRequest();
62  void onActivityModeChanged(MaskEditorFlags::Activity value);
63 
64 private:
65  void setColorMap(ColorMap* colorMap);
66  void setConnected(bool isConnected);
67 
72 
73  MaskItem* m_liveProjection; //!< temporary projection item matching mouse move
75  QModelIndex m_containerIndex;
77 
78  MaskEditorFlags::Activity m_currentActivity;
80 };
81 
82 #endif // BORNAGAIN_GUI_VIEW_PROJECTION_PROJECTIONSEDITORCANVAS_H
Defines class MaskEditorFlags.
The ColorMap class presents 2D intensity data from IntensityDataItem as color map.
Definition: ColorMap.h:36
Graphics scene for MaskEditorCanvas to draw masks on top of intensity data widgets.
Graphics view for MaskEditorCanvas.
A base class for all mask items.
Definition: MaskItems.h:27
The PlotStatusLabel class shows status string as reported by DescriptedPlot in a frame....
Holds a graphics scene to draw projections on top of ColorMap. Being a part of ProjectionEditor,...
void setSelectionModel(QItemSelectionModel *model)
MaskEditorFlags::Activity m_currentActivity
void onActivityModeChanged(MaskEditorFlags::Activity value)
void onPositionChanged(double x, double y)
ProjectionsEditorCanvas(QWidget *parent=nullptr)
MaskItem * m_liveProjection
temporary projection item matching mouse move
void changeActivityRequest(MaskEditorFlags::Activity)
void setConnected(bool isConnected)
void setContext(SessionModel *model, const QModelIndex &shapeContainerIndex, IntensityDataItem *intensityItem)
void marginsChanged(double left, double right)
void setColorMap(ColorMap *colorMap)
MaskGraphicsScene * getScene()
IntensityDataItem * m_intensityDataItem
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
Definition: SessionModel.h:42