You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.4 KiB
C++

#ifndef CIRCULAR_H
#define CIRCULAR_H
//Qt
#include <QColor>
#include <QPainter>
#include <QPainterPath>
#include <QPaintEvent>
#include <QVector>
#include <QPainterPathStroker>
#include <QPen>
#include <QWidget>
#include <QPaintEngine>
#include <QPoint>
#include <QRect>
#include <QThread>
class Circular
{
public:
Circular(){
_scalex = 1;
_scaley = 1;
}
Circular(const QPointF& center){
_center = center;
_scalex = 1;
_scaley = 1;
}
void paint(QPixmap& w, QPaintEvent* event=nullptr){
QPainter painter;
painter.begin(&w);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.scale(_scalex,_scaley);
painter.setPen(QPen(Qt::black, 0.8));
painter.drawEllipse(_center,_radius,_radius);
painter.end();
}
QPointF center() const
{
return _center;
}
void setCenter(const QPointF &center)
{
_center = center;
}
QColor color() const
{
return _color;
}
void setColor(const QColor &color)
{
_color = color;
}
double radius() const
{
return _radius;
}
void setRadius(double radius)
{
_radius = radius;
}
private:
QPointF _center;
double _radius;
double _scalex;
double _scaley;
QColor _color;
};
#endif // CIRCULAR_H