最新版本没有mutableKeys和mutableValues
时间: 2023-07-30 10:06:33 浏览: 51
是的,您说得对,最新版本的 QCustomPlot 没有 `mutableKeys()` 和 `mutableValues()` 方法了。如果您想要将点存储到 QCustomPlot 的内存块中,可以使用下面的方法:
1. 获取 QCPGraph 对象:
```cpp
QCustomPlot *customPlot = new QCustomPlot();
QCPGraph *graph = customPlot->addGraph();
```
2. 将点数据添加到 QCPGraph 对象中:
```cpp
double x = 0.1;
double y = 0.2;
graph->addData(x, y);
```
3. 通过重新绘制 QCustomPlot 对象来显示更新后的数据:
```cpp
customPlot->replot();
```
这样就可以将点数据存储到 QCustomPlot 的内存块中,并实时更新到图像界面中了。
相关问题
如何在qcustomplot直接将点存到qcustomplot得内存块中
在 QCustomPlot 中,可以通过以下步骤将点存储到内存块中:
1. 获取指向 QCustomPlot 内部数据结构的指针:
```cpp
QCustomPlot *customPlot = new QCustomPlot();
QCPGraph *graph = customPlot->addGraph();
QVector<double> *xData = graph->data()->mutableKeys();
QVector<double> *yData = graph->data()->mutableValues();
```
2. 将数据添加到 QCPGraph 对象中:
```cpp
double x = 0.1;
double y = 0.2;
xData->append(x);
yData->append(y);
```
3. 通过重新绘制 QCustomPlot 对象来显示更新后的数据:
```cpp
customPlot->replot();
```
通过上述步骤,可以实现在 QCustomPlot 中直接将点存储到内存块中,并实时更新到图像界面中。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)