paint.h
#ifndef PAINT_H
#define PAINT_H
#include <QWidget>
#include <QTimer>
#include <QPainter>
namespace Ui {
class Paint;
}
class Paint : public QWidget
{
Q_OBJECT
public:
explicit Paint(QWidget *parent = nullptr);
~Paint();
private:
void paintEvent(QPaintEvent *event);
void DrawLineWithArrow(QPainter& painter,QPen& pen, QPointF& start, QPoint end);
private:
Ui::Paint *ui;
double angle = 0; //箭头1初始角度
double angle2 = 0; //箭头2初始角度
QTimer *timeUP;
double PI = 3.14159;
QPointF circle_center; //圆心
qreal R; //圆的半径
protected:
QPointF trans(int angle);
};
#endif // PAINT_H
paint.cpp
#include "paint.h"
#include "ui_paint.h"