49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#ifndef GRAPHICSARCITEM_H
|
|
#define GRAPHICSARCITEM_H
|
|
|
|
#include <QColor>
|
|
#include <QGraphicsItem>
|
|
#include <QPainter>
|
|
#include "math.h"
|
|
|
|
class graphicsArcItem : public QGraphicsItem
|
|
{
|
|
public:
|
|
graphicsArcItem(qreal x=0, qreal y=0, qreal r=0, qreal a1=0, qreal a2=0);
|
|
QRectF boundingRect() const;
|
|
// QPainterPath shape() const;
|
|
|
|
|
|
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
|
|
qreal radius() {return r;}
|
|
QColor color() {return col;}
|
|
qreal angle1() {return a1;}
|
|
qreal angle2() {return a2;}
|
|
void setColor(QColor c);
|
|
void setRadius(qreal rr);
|
|
void setAngle1(qreal a);
|
|
void setAngle2(qreal a);
|
|
void setAngles(qreal aa, qreal ab);
|
|
bool isTextVisible() {return textVisible;}
|
|
void setTextVisible(bool fl) {textVisible=fl;}
|
|
|
|
void setText(QString str1="", QString str2="");
|
|
void setText1(QString str) {prepareGeometryChange();textLeft=str;}
|
|
void setText2(QString str) {prepareGeometryChange();textRight=str;}
|
|
|
|
|
|
|
|
private:
|
|
qreal x, y, r, a1, a2;
|
|
QColor col;
|
|
bool textVisible;
|
|
QString textLeft, textRight;
|
|
};
|
|
|
|
#endif // GRAPHICSARCITEM_H
|
|
|
|
|