BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
EllipseView.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/EllipseView.h
6 //! @brief Defines EllipseView 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_ELLIPSEVIEW_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_MASKWIDGETS_ELLIPSEVIEW_H
17 
19 
20 //! This is a View of ellipse mask (represented by EllipseItem) 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::ELLIPSE; }
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 private:
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_ELLIPSEVIEW_H
Defines RectangleBaseView class.
This is a View of ellipse mask (represented by EllipseItem) on GraphicsScene.
Definition: EllipseView.h:23
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
QRectF mask_rectangle()
qreal right() const
returns the x-coordinate of the rectangle's right edge
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: EllipseView.cpp:58
virtual void onPropertyChange(const QString &propertyName)
Definition: EllipseView.cpp:36
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
Definition: EllipseView.cpp:49
void update_position()
updates position of view using item properties
virtual void onChangedY()
Definition: EllipseView.cpp:29
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
int type() const
Definition: EllipseView.h:27
qreal left() const
returns the x-coordinate of the rectangle's left edge
virtual void onChangedX()
Definition: EllipseView.cpp:22
Base view for all rectangular-like masks.