天嵌 ARM开发社区

 找回密码
 注册
查看: 1558|回复: 0

qt读取txt文件数据并曲线显示问题

[复制链接]
宇仲贾 发表于 2016-5-26 12:52:12 | 显示全部楼层 |阅读模式
目前想用qt提取txt文件中的数据并以曲线形式显示出来,但一直没有曲线显示,请大神指教。
程序部分代码如下:
QFile file("test.txt");   
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )        
     return ;     
QTextStream in(&file);        
while(!in.atEnd())
{            
    data=in.readLine();//data为QString类            
    //process_line(data);            
    qDebug()<<data<<endl;            
    plot_data = data.split(" ");//plot_data为QStringList类            
    qDebug()<<plot_data<<endl;        
}   
   QVector<double> xs;   
   QVector<double> ys;   
   for(double i = 0; i<plot_data.size(); i++)   
{        
    value = plot_data[i].toDouble();        
    xs.append(i);         
    ys.append(value);   
}
    d_curve->setSamples(xs, ys);
test.txt文件如下:
-1-0.8-0.6-0.5-0.3-0.10.10.20.30.50.70.80.91.00.80.70.50.30.11为什么曲线不能绘制出来呢?请大神指教,谢谢
还有process_line(data);如果不注释掉,编译出错:error: 'process_line' was not declared in this scope

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-3-28 20:47 , Processed in 1.078131 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表