BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RegionOfInterestView.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Mask/RegionOfInterestView.cpp
6 //! @brief Defines RegionOfInterestView 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 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
18 #include <QPainter>
19 
21  : RectangleView(item)
22 {
23 }
24 
26 {
27  return mapFromScene(m_adaptor->viewportRectangle()).boundingRect();
28 }
29 
31 {
34  update();
35 }
36 
37 void RegionOfInterestView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
38 {
39  QPainterPath outerRect;
40  outerRect.addRect(boundingRect());
41 
42  QPainterPath innerRect;
43  innerRect.addRect(m_mask_rect);
44 
45  painter->setBrush(MaskEditorHelper::getMaskBrush(true));
46  painter->drawPath(outerRect.subtracted(innerRect));
47 }
Defines interface class ISceneAdaptor.
Defines MaskItems classes.
Defines RegionOfInterestView class.
virtual const QRectF & viewportRectangle() const
Returns viewport rectangle in scene coordinates.
Definition: ISceneAdaptor.h:39
const ISceneAdaptor * m_adaptor
Definition: IShape2DView.h:67
QRectF m_bounding_rect
Definition: IShape2DView.h:68
static QBrush getMaskBrush(bool mask_value)
QRectF m_mask_rect
mask rectangle in scene coordinates
void update_view() override
update visual appearance of view (triggered by ISceneAdaptor)
This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene....
Definition: RectangleView.h:25
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
RegionOfInterestView(RegionOfInterestItem *item)
QRectF boundingRect() const override