BornAgain  1.19.0
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/coregui/Views/MaskWidgets/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_COREGUI_VIEWS_MASKWIDGETS_RECTANGLEVIEW_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_MASKWIDGETS_RECTANGLEVIEW_H
17 
19 
20 //! This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene.
21 //! Given view follows standard QGraphicsScene notations: (x,y) is top left corner.
22 
24  Q_OBJECT
25 
26 public:
27  int type() const { return MaskEditorHelper::RECTANGLE; }
28 
30 
31 protected slots:
32  virtual void onChangedX();
33  virtual void onChangedY();
34  virtual void onPropertyChange(const QString& propertyName);
35 
36 protected:
37  void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
38  void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
39 
40 protected:
41  void update_position();
42  QRectF mask_rectangle();
43  qreal left() const;
44  qreal right() const;
45  qreal top() const;
46  qreal bottom() const;
47 };
48 
49 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_MASKWIDGETS_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:23
QRectF mask_rectangle()
virtual void onChangedX()
qreal left() const
returns the x-coordinate of the rectangle's left edge
virtual void onPropertyChange(const QString &propertyName)
int type() const
Definition: RectangleView.h:27
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void update_position()
updates position of view using item properties
qreal right() const
returns the x-coordinate of the rectangle's right edge
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
virtual void onChangedY()