BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RectangleView.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Mask/RectangleView.h
6 //! @brief Defines RectangleView 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 
15 #ifndef BORNAGAIN_GUI_VIEW_MASK_RECTANGLEVIEW_H
16 #define BORNAGAIN_GUI_VIEW_MASK_RECTANGLEVIEW_H
17 
19 
20 class RectangleItem;
21 
22 //! This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene.
23 //! Given view follows standard QGraphicsScene notations: (x,y) is top left corner.
24 
26  Q_OBJECT
27 
28 public:
29  int type() const override { return MaskEditorHelper::RECTANGLE; }
30 
31  explicit RectangleView(RectangleItem* item);
32  ~RectangleView() override;
33  QPainterPath shape() const override;
34  SessionItem* parameterizedItem() const override;
35 
36 protected slots:
37  void onChangedX() override;
38  void onChangedY() override;
39  void onPropertyChange() override;
40 
41 protected:
42  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
43 
44 protected:
45  void update_position() override;
46  QRectF mask_rectangle() override;
47  qreal left() const override;
48  qreal right() const override;
49  qreal top() const override;
50  qreal bottom() const override;
51 
52 private:
53  void onItemDestroyed() override;
54 
55 private:
57 };
58 
59 #endif // BORNAGAIN_GUI_VIEW_MASK_RECTANGLEVIEW_H
Defines RectangleBaseView class.
Base view for all rectangular-like masks.
This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene....
Definition: RectangleView.h:25
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
QRectF mask_rectangle() override
qreal left() const override
Returns the x-coordinate of the rectangle's left edge.
QPainterPath shape() const override
void onItemDestroyed() override
qreal bottom() const override
Returns the y-coordinate of the rectangle's bottom edge.
void onChangedY() override
void update_position() override
updates position of view using item properties
qreal top() const override
Returns the y-coordinate of the rectangle's top edge.
qreal right() const override
Returns the x-coordinate of the rectangle's right edge.
SessionItem * parameterizedItem() const override
~RectangleView() override
void onChangedX() override
int type() const override
Definition: RectangleView.h:29
RectangleItem * m_item
Definition: RectangleView.h:56
void onPropertyChange() override
RectangleView(RectangleItem *item)
Base class for a GUI data item.
Definition: SessionItem.h:204