libkpl  5.0
A Library for Graphical Presentation of Data Sets and Functions
ellipseitem.h
1 /***************************************************************************
2  ellipseitem.h - description
3  -------------------
4  begin : Sun Apr 29 2001
5  copyright : (C) 2017 by Werner Stille
6  email : kpl@werner-stille.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef ELLIPSEITEM_H
19 #define ELLIPSEITEM_H
20 
21 #include <QGraphicsEllipseItem>
22 #include "decoitem.h"
23 
28 class Q_DECL_EXPORT EllipseItem : public DecoItem, public QGraphicsEllipseItem
29 {
30 public:
32  enum {Type = UserType + Ellipse
36  };
51  EllipseItem(double x0 = 0, double y0 = 0, unsigned color = 0,
52  QGraphicsItem* parent = 0, double width = 3, double height = 2,
53  bool visible = true, FillStyle fillStyle = NoBrush,
54  Symbol symbol = SolidLine, double relSize = 1, double dir = 0);
59  EllipseItem(const EllipseItem& a);
66  EllipseItem(const KConfigGroup* plo, unsigned color = 0,
67  QGraphicsItem* parent = 0);
69  virtual ~EllipseItem();
71  inline double dir() const { return m_dir; };
73  inline FillStyle fillStyle() const { return m_fillStyle; };
75  inline double height() const { return m_height; };
77  QPixmap pixmap() const;
82  inline void setDir( double dir) { m_dir = dir; };
87  inline void setFillStyle(FillStyle style) { m_fillStyle = style; };
92  inline void setHeight(double height) { m_height = height; };
94  void setPenWidth();
99  void setProperties(const QTransform& m);
104  inline void setSymbol(Symbol symbol) { m_symbol = symbol; };
109  inline void setWidth(double width) { m_width = width; };
111  inline Symbol symbol() const { return m_symbol; };
113  virtual int type() const { return Type; };
115  void update();
117  inline double width() const { return m_width; };
122  void writePlo(KConfigGroup* plo) const;
123 
124 protected:
126  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
128  void setProperties();
129  FillStyle m_fillStyle;
130  double m_width, m_height, m_dir;
131  Symbol m_symbol;
132 };
133 
134 #endif
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
double width() const
Returns width in cm.
Definition: ellipseitem.h:117
Symbol
Symbol types.
Definition: kplitem.h:83
void writePlo(KConfigGroup *plo, bool visible) const
Writes into plot file.
void setFillStyle(FillStyle style)
Sets fill style.
Definition: ellipseitem.h:87
void update(const QRectF &rect)
virtual int type() const
Returns specific QGraphicsItem type number.
Definition: ellipseitem.h:113
double height() const
Returns height in cm.
Definition: ellipseitem.h:75
void setSymbol(Symbol symbol)
Sets line type.
Definition: ellipseitem.h:104
void setDir(double dir)
Sets rotation angle.
Definition: ellipseitem.h:82
FillStyle fillStyle() const
Returns fill style.
Definition: ellipseitem.h:73
static QPixmap pixmap(Symbol symbol)
Returns black decoration pixmap of plot symbol for use in dialog GUI.
void setWidth(double width)
Sets width.
Definition: ellipseitem.h:109
Decoration item class.
Definition: decoitem.h:35
Ellipse item class.
Definition: ellipseitem.h:28
Symbol symbol() const
Returns line type.
Definition: ellipseitem.h:111
double dir() const
Returns rotation angle in deg.
Definition: ellipseitem.h:71
void setHeight(double height)
Sets height.
Definition: ellipseitem.h:92