📄 cpuaveragecurve.cpp
字号:
#include <qpainter.h>#include <qwt_painter.h>#include "cpuplot.h"#include "cpuaveragecurve.h"CpuAverageCurve::CpuAverageCurve(CpuPlot *plot): QwtPlotCurve(plot){}void CpuAverageCurve::drawCurve(QPainter *painter, int, const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to){ QPointArray polyline( 2 * (to - from + 1)); int idx = 0; for (register int i = from; i <= to; i++, idx++) { int xi = xMap.transform(x(i)); int yi = yMap.transform(y(i)); polyline.setPoint(idx, xi, yi); } const CpuPlot *plot = (const CpuPlot *)parentPlot(); const QwtPlotCurve *totalCurve = plot->cpuCurve(CpuPlot::Total); for (register int j = to; j >= from; j--, idx++) { int xj = xMap.transform(totalCurve->x(j)); int yj = yMap.transform(totalCurve->y(j)); polyline.setPoint(idx, xj, yj); } QwtPainter::drawPolygon(painter, polyline);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -