BornAgain  1.19.0
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/coregui/Views/MaskWidgets/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), m_sceneAdaptor(0), m_send_signals_to_colormap(false)
23 {
24  resize(1200, 1000);
25  setInZoomMode(true);
26 }
27 
29 {
30  // no need to delete m_colorMap, base QGraphicsProxyWidget will take care about it
31  if (m_sceneAdaptor)
33 }
34 
36 {
38  if (widget() != m_colorMap)
39  setWidget(m_colorMap);
40 }
41 
43 {
44  if (m_sceneAdaptor)
46 
47  m_sceneAdaptor = dynamic_cast<ColorMapSceneAdaptor*>(sceneAdaptor);
48 
49  if (m_sceneAdaptor)
51 }
52 
53 //! Sets widget to zoom mode, when signals (zoom wheel, mouse clicks) are send down to
54 //! ColorMap plot. In non-zoom mode, widget doesn't react on clicks.
56 {
58  if (value) {
59  setAcceptedMouseButtons(Qt::LeftButton);
60  } else {
61  setAcceptedMouseButtons(Qt::NoButton);
62  }
63 }
64 
66 {
67  return m_colorMap;
68 }
69 
70 void MaskGraphicsProxy::mousePressEvent(QGraphicsSceneMouseEvent* event)
71 {
73  return;
74  QGraphicsProxyWidget::mousePressEvent(event);
75  event->accept();
76 }
77 
78 void MaskGraphicsProxy::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
79 {
81  return;
82  QGraphicsProxyWidget::mouseReleaseEvent(event);
83 }
84 
85 void MaskGraphicsProxy::wheelEvent(QGraphicsSceneWheelEvent* event)
86 {
88  return;
89  QGraphicsProxyWidget::wheelEvent(event);
90 }
91 
92 void MaskGraphicsProxy::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
93 {
95  return;
96  QGraphicsProxyWidget::mouseMoveEvent(event);
97 }
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 mousePressEvent(QGraphicsSceneMouseEvent *event)
void wheelEvent(QGraphicsSceneWheelEvent *event)
void setIntensityItem(IntensityDataItem *item)
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
ColorMapSceneAdaptor * m_sceneAdaptor
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.