标签:pen define explicit clu debug idg style mat paint
plot.h
#ifndef PLOT_H
#define PLOT_H
#include<QTimer>
#include <QWidget>
class pathplot : public QWidget
{
Q_OBJECT
public:
explicit pathplot(QWidget *parent = nullptr);
void paintEvent(QPaintEvent *event);
};
#endif // PLOT_H
plot.cpp
# include"circlewidget.h" #include<QPainter> #include<QDebug> #include<math.h> plot::CircleWidget(QWidget *parent):QFrame(parent) { m_period = 20; //周期 m_grain = 1; //粒度 m_radius = 10; // 振幅 } plot::~CircleWidget() { }
void pathplot::paintEvent(QPaintEvent *event) {
QPainter painter(this);
QPointF pointf[10];
pen.setWidth(6);
painter.setPen(pen); // 设置画笔
for (int i=0; i<10; ++i)
{
pointf[i].setX(2.0+i*10.0);
pointf[i].setY(130.0);
}
painter.drawPoints(pointf, 10);
}
标签:pen define explicit clu debug idg style mat paint
原文地址:https://www.cnblogs.com/fuhang/p/9909280.html