qcustomplot.h
class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D<QCPGraphData> { public: ... void setSmooth(bool smooth); // 新增内容 protected: ... bool mSmooth; // 新增内容 }
qcustomplot.cpp
QCPGraph::QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D<QCPGraphData>(keyAxis, valueAxis) { ... mSmooth = false; // 新增内容 }
void QCPGraph::setSmooth(bool smooth) { mSmooth = smooth; }
void QCPGraph::drawLinePlot(QCPPainter *painter, const QVector<QPointF> &lines) const { if (painter->pen().style() != Qt::NoPen && painter->pen().color().alpha() != 0) { applyDefaultAntialiasingHint(painter); if (mSmooth && mLineStyle == lsLine) painter->drawPath(SmoothCurveGenerator::generateSmoothCurve(lines)); else drawPolyline(painter, lines); } }
启用平滑曲线
ui->Plot->graph(0)->setSmooth(true);
标签:mSmooth,...,QCPGraph,平滑,QCustonPlot,添加,bool,void,painter From: https://www.cnblogs.com/wuyuan2011woaini/p/18555141