BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
graphicsscene.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/sldeditor/graphicsscene.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI2_SLDEDITOR_GRAPHICSSCENE_H
16 #define BORNAGAIN_GUI2_SLDEDITOR_GRAPHICSSCENE_H
17 
18 #include "darefl_export.h"
19 #include <QGraphicsScene>
20 #include <memory>
21 
22 namespace ModelView {
23 class GraphCanvas;
24 class SceneAdapterInterface;
25 class GraphViewportItem;
26 class CustomPlotProxyWidget;
27 } // namespace ModelView
28 
29 namespace gui2 {
30 
32 
33 //! Custom graphics scene to show QCustomPlot with additional elements on top.
34 class DAREFLCORE_EXPORT GraphicsScene : public QGraphicsScene {
35  Q_OBJECT
36 
37 public:
38  GraphicsScene(QObject* parent = nullptr);
39  ~GraphicsScene() override;
40 
41  void setContext();
42  void setItem(ModelView::GraphViewportItem* viewport_item);
43  ModelView::GraphCanvas* graphCanvas() const;
44  ModelView::SceneAdapterInterface* sceneAdapter() const;
45  void update_size(const QSize& newSize);
46 
47 private:
48  void createPlotProxy(ModelView::GraphCanvas* plot_canvas);
49  ModelView::CustomPlotProxyWidget* plot_proxy{nullptr};
50  std::unique_ptr<ModelView::SceneAdapterInterface> scene_adapter;
51  ModelView::GraphCanvas* graph_canvas{nullptr};
52 };
53 
54 } // namespace gui2
55 
56 #endif // BORNAGAIN_GUI2_SLDEDITOR_GRAPHICSSCENE_H
Custom proxy widget to embed color map in graphics scene.
Widget to show scientific figure with multiple 1D graphs.
Definition: graphcanvas.h:30
2D viewport specialized for showing multiple GraphItem's.
Interface to convert coordinates of "scene" to coordinates of "widget".
Custom graphics scene to show QCustomPlot with additional elements on top.
Definition: graphicsscene.h:34
~GraphicsScene() override
The destructor.
std::unique_ptr< ModelView::SceneAdapterInterface > scene_adapter
Definition: graphicsscene.h:50
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20