Qt - 动态绘制结果
Qt - plot results dynamically in time
我已经编写了一个模拟程序,它解决了几个方程并在OpenGL窗口中绘制结果。模拟会随着时间的推移而不断发展。我想动态添加积分。我正在使用如下代码:
QwtPlot* plot = new...;
QwtPlotCurve* plotdata = new...;
QVector<QPoint> data = getData();
plotdata->setSamples(data);
这会让情节重置所有点。我可以简单地添加积分吗?
感谢您的任何努力:-)
如果没有办法做到这一点,我很想听听。请告诉我!
使用具有
可调间隔和QSpinBox
的QTimer
怎么样?
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updatePlot()));
timer->start(5000); //adjust from GUI with timer->setInterval(newValue)
...
void updatePlot(){
// QSettings initialized somewhere
int maxSamples = settings.value("plot/maxSamples", 100).toInt();
QVector<QPoint> data = getData(maxSamples); // get this many samples
plotdata->setSamples(data);
}
我明白了。没有办法以这种抽象的方式做到这一点。但人们可以回想一下方法:
void QwtPlotCurve::setRawSamples();
使用 replot(),这将是最便宜的方法。它不涉及任何数据复制。
干杯:)
相关文章:
- 为什么"do while"循环不断退出,即使条件计算结果为 false?
- valgrind-hellgrind与泄漏检查的结果不同
- 用C++20 fmt限制结果的总大小
- 如何返回一个类的两个对象相加的结果
- 使用QProcess执行命令,并将结果存储在QStringList中
- 如果我std::dynamic_pointer_cast并且底层dynamic_cast的结果为null,那么返回的sh
- 在没有定义返回类型的函数中返回布尔值,并将结果保存在无错误的char编译中-为什么
- QuadTree只在窗口的右上角绘制
- 绘制旋转的三角形
- 序列化,没有库的整数,得到奇怪的结果
- 使用取消引用的指针的多态性会产生意外的结果.为什么?
- 在更改for循环的第三部分后,未使用for循环结果
- flutter:即使shouldRepaint()返回true,自定义画家也不会重新绘制
- 使用++运算符会导致意外的结果
- 为什么在逗号分隔符上下文中将预增量的结果强制转换为void
- C++Brute Force攻击函数不会返回结果
- 如何在我的子类控件paint方法中在默认的paint结果之上绘制一些东西
- Qt - 动态绘制结果
- QPainter::begin:小部件绘制只能作为paintEvent的结果开始
- 绘制c++代码中间结果的最佳工具是什么?