BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskGraphicsProxy.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Mask/MaskGraphicsProxy.cpp
6 //! @brief Implements class MaskGraphicsProxy
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 
19 #include <QGraphicsSceneMouseEvent>
20 
22  : m_colorMap(new ColorMap)
23  , m_sceneAdaptor(nullptr)
24  , m_send_signals_to_colormap(false)
25 {
26  resize(1200, 1000);
27  setInZoomMode(true);
28 }
29 
31 {
32  // no need to delete m_colorMap, base QGraphicsProxyWidget will take care about it
33  if (m_sceneAdaptor)
35 }
36 
38 {
40  if (widget() != m_colorMap)
41  setWidget(m_colorMap);
42 }
43 
45 {
46  if (m_sceneAdaptor)
48 
49  m_sceneAdaptor = dynamic_cast<ColorMapSceneAdaptor*>(sceneAdaptor);
50 
51  if (m_sceneAdaptor)
53 }
54 
55 //! Sets widget to zoom mode, when signals (zoom wheel, mouse clicks) are send down to
56 //! ColorMap plot. In non-zoom mode, widget doesn't react on clicks.
58 {
60  if (value)
61  setAcceptedMouseButtons(Qt::LeftButton);
62  else
63  setAcceptedMouseButtons(Qt::NoButton);
64 }
65 
67 {
68  return m_colorMap;
69 }
70 
71 void MaskGraphicsProxy::mousePressEvent(QGraphicsSceneMouseEvent* event)
72 {
74  return;
75  QGraphicsProxyWidget::mousePressEvent(event);
76  event->accept();
77 }
78 
79 void MaskGraphicsProxy::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
80 {
82  return;
83  QGraphicsProxyWidget::mouseReleaseEvent(event);
84 }
85 
86 void MaskGraphicsProxy::wheelEvent(QGraphicsSceneWheelEvent* event)
87 {
89  return;
90  QGraphicsProxyWidget::wheelEvent(event);
91 }
92 
93 void MaskGraphicsProxy::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
94 {
96  return;
97  QGraphicsProxyWidget::mouseMoveEvent(event);
98 }
Defines class ColorMapSceneAdaptor.
Defines class ColorMap.
Defines class IntensityDataItem.
Defines class MaskGraphicsProxy.
Performs conversion of MaskItems coordinates between ColorMap and GraphicsScene.
void setColorMapPlot(ColorMap *plot)
The ColorMap class presents 2D intensity data from IntensityDataItem as color map.
Definition: ColorMap.h:36
Interface to adapt MaskItems coordinates (expressed in units of IntensityDataItem) to/from scene coor...
Definition: ISceneAdaptor.h:24
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
void setIntensityItem(IntensityDataItem *item)
void wheelEvent(QGraphicsSceneWheelEvent *event) override
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
~MaskGraphicsProxy() override
ColorMapSceneAdaptor * m_sceneAdaptor
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
void setInZoomMode(bool value)
Sets widget to zoom mode, when signals (zoom wheel, mouse clicks) are send down to ColorMap plot....
void setSceneAdaptor(ISceneAdaptor *sceneAdaptor)
virtual void setItem(SessionItem *item)
IntensityDataItem * intensityDataItem(SessionItem *parent)
Returns IntensityDataItem contained as a child in givent parent.