BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskAllView.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Mask/MaskAllView.cpp
6 //! @brief Implements MaskAllView 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 <QBrush>
19 #include <QPainter>
20 #include <QStyleOptionGraphicsItem>
21 
23  : IShape2DView(item)
24  , m_item(item)
25 {
26  setFlag(QGraphicsItem::ItemIsSelectable);
27 }
28 
30 {
32 }
33 
35 {
36  return m_item;
37 }
38 
40 {
41  // prepareGeometryChange();
43  update();
44 }
45 
46 void MaskAllView::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*)
47 {
48  // painter->setRenderHints(QPainter::Antialiasing);
49  QColor color(250, 250, 240, 150);
50  painter->setBrush(color);
51  painter->drawRect(m_bounding_rect);
52 
53  if (isSelected()) {
54  QPen pen;
55  pen.setStyle(Qt::DashLine);
56  painter->setPen(pen);
57  painter->setBrush(Qt::NoBrush);
58  painter->drawRect(m_bounding_rect);
59  }
60 }
61 
63 {
64  m_item = nullptr;
65 }
Defines class ColorMapSceneAdaptor.
Defines MaskAllView class.
Defines MaskItems classes.
virtual const QRectF & viewportRectangle() const
Returns viewport rectangle in scene coordinates.
Definition: ISceneAdaptor.h:39
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27
const ISceneAdaptor * m_adaptor
Definition: IShape2DView.h:67
void disconnectFromItem(SessionItem *item)
QRectF m_bounding_rect
Definition: IShape2DView.h:68
void onItemDestroyed() override
Definition: MaskAllView.cpp:62
MaskAllItem * m_item
Definition: MaskAllView.h:45
void update_view() override
Definition: MaskAllView.cpp:39
SessionItem * parameterizedItem() const override
Definition: MaskAllView.cpp:34
MaskAllView(MaskAllItem *item)
Definition: MaskAllView.cpp:22
~MaskAllView() override
Definition: MaskAllView.cpp:29
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
Definition: MaskAllView.cpp:46
Base class for a GUI data item.
Definition: SessionItem.h:204