libkpl  6.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) 2024 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
28class Q_DECL_EXPORT EllipseItem : public DecoItem, public QGraphicsEllipseItem
29{
30public:
32 enum {Type = UserType + Ellipse
36 };
51 EllipseItem(double x0 = 0, double y0 = 0, unsigned color = 0,
52 QGraphicsItem* parent = nullptr, double width = 3,
53 double height = 2, bool visible = true,
54 FillStyle fillStyle = NoBrush, Symbol symbol = SolidLine,
55 double relSize = 1, double dir = 0);
67 EllipseItem(const KConfigGroup* plo, unsigned color = 0,
68 QGraphicsItem* parent = nullptr);
70 virtual ~EllipseItem();
72 inline double dir() const { return m_dir; };
74 inline FillStyle fillStyle() const { return m_fillStyle; };
76 inline double height() const { return m_height; };
78 QPixmap pixmap() const;
83 inline void setDir( double dir) { m_dir = dir; };
88 inline void setFillStyle(FillStyle style) { m_fillStyle = style; };
93 inline void setHeight(double height) { m_height = height; };
100 void setProperties(const QTransform& m);
105 inline void setSymbol(Symbol symbol) { m_symbol = symbol; };
110 inline void setWidth(double width) { m_width = width; };
112 inline Symbol symbol() const { return m_symbol; };
114 virtual int type() const override { return Type; };
116 void update();
118 inline double width() const { return m_width; };
123 void writePlo(KConfigGroup* plo) const;
124
125protected:
127 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
130 FillStyle m_fillStyle;
131 double m_width, m_height, m_dir;
132 Symbol m_symbol;
133};
134
135#endif
Decoration item class.
Definition decoitem.h:36
Ellipse item class.
Definition ellipseitem.h:29
void setDir(double dir)
Sets rotation angle.
Definition ellipseitem.h:83
EllipseItem(double x0=0, double y0=0, unsigned color=0, QGraphicsItem *parent=nullptr, double width=3, double height=2, bool visible=true, FillStyle fillStyle=NoBrush, Symbol symbol=SolidLine, double relSize=1, double dir=0)
Constructor.
double width() const
Returns width in cm.
Definition ellipseitem.h:118
void setFillStyle(FillStyle style)
Sets fill style.
Definition ellipseitem.h:88
EllipseItem(const EllipseItem &a)
Copy constructor.
void writePlo(KConfigGroup *plo) const
Writes into plot file.
double dir() const
Returns rotation angle in deg.
Definition ellipseitem.h:72
void setWidth(double width)
Sets width.
Definition ellipseitem.h:110
FillStyle fillStyle() const
Returns fill style.
Definition ellipseitem.h:74
EllipseItem(const KConfigGroup *plo, unsigned color=0, QGraphicsItem *parent=nullptr)
Constructor.
void setSymbol(Symbol symbol)
Sets line type.
Definition ellipseitem.h:105
double height() const
Returns height in cm.
Definition ellipseitem.h:76
virtual ~EllipseItem()
Destructor.
void setHeight(double height)
Sets height.
Definition ellipseitem.h:93
QPixmap pixmap() const
Returns decoration pixmap for item list.
void update()
Applies changes and forces redrawing.
void setProperties(const QTransform &m)
Sets properties according to transformation matrix.
void setPenWidth()
Sets pen width.
Symbol symbol() const
Returns line type.
Definition ellipseitem.h:112
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
Updates position.
void setProperties()
Sets properties according to transformation matrix.
virtual int type() const override
Returns specific QGraphicsItem type number.
Definition ellipseitem.h:114
FillStyle
Fill styles.
Definition kplitem.h:45
Symbol
Symbol types.
Definition kplitem.h:83