timer = new QTimer(this);
timer->setInterval(10);
connect(timer, SIGNAL(timeout()), this, SLOT(drawGraph()));
timer->start();
void trypixmap::drawGraph()
{
......
QVector
for (int j = 0; j < buffer.count(); ++j) {
double dx = buffer[j].x() - settings.minX;
double dy = buffer[j].y() - settings.minY;
double x = rect.left() + (dx * (rect.width() - 1)/ settings.spanX());
double y = rect.bottom() - (dy * (rect.height() - 1)/ settings.spanY());
polyline[j] = QPointF(x, y);
if (j>0)
painter->drawLine(polyline[j-1],polyline[j]);
else
painter->drawPoint(x,y);
}
我本来设置的是10MS的间隔,但是在开发板上实际的刷新速度远远大于10MS,估计有100MS以上。求达人解释。