BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ScientificPlotEvent.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotUtil/ScientificPlotEvent.h
6 //! @brief Defines class ScientificPlotEvent
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_PLOTUTIL_SCIENTIFICPLOTEVENT_H
16 #define BORNAGAIN_GUI_VIEW_PLOTUTIL_SCIENTIFICPLOTEVENT_H
17 
19 #include <QObject>
20 #include <memory>
21 
22 class ScientificPlot;
23 class QMouseEvent;
24 class QCustomPlot;
25 
26 //! Helps ScientificPlot to handle mouse events. Particularly, it constructs a valid
27 //! status string. Can be extended to play a role of event filter.
28 
29 class ScientificPlotEvent : public QObject {
30  Q_OBJECT
31 
32 public:
33  explicit ScientificPlotEvent(ScientificPlot* scientific_plot);
35 
36  void setMouseTrackingEnabled(bool enable);
37 
38 signals:
39  void enteringPlot();
40  void leavingPlot();
41  void positionChanged(double x, double y);
42 
43 public slots:
44  void onCustomMouseMove(QMouseEvent* event);
45 
46 private:
48  const ScientificPlot* scientificPlot() const;
49  QCustomPlot* customPlot();
50  PlotEventInfo currentPlotDescriptor(QMouseEvent* event) const;
51 
54 };
55 
56 #endif // BORNAGAIN_GUI_VIEW_PLOTUTIL_SCIENTIFICPLOTEVENT_H
Defines the class PlotEventInfo.
Contains parameters of mouse position in 1D or 2D plot.
Definition: PlotEventInfo.h:26
Helps ScientificPlot to handle mouse events. Particularly, it constructs a valid status string....
ScientificPlot * m_plot
~ScientificPlotEvent() override
ScientificPlot * scientificPlot()
void positionChanged(double x, double y)
PlotEventInfo currentPlotDescriptor(QMouseEvent *event) const
Constructs current position of the data.
void onCustomMouseMove(QMouseEvent *event)
Constructs status string on mouse move event coming from QCustomPlot. String is emitted if mouse is i...
ScientificPlotEvent(ScientificPlot *scientific_plot)
QCustomPlot * customPlot()
void setMouseTrackingEnabled(bool enable)
Sets tracking of the mouse for parent DescriptedPlot.
Common interface for plot-descriptor interaction.