• 4745阅读
  • 1回复

qwt中的例子cpuplot的问题 [复制链接]

上一主题 下一主题
离线lyb1900
 
只看楼主 倒序阅读 楼主  发表于: 2010-05-23
成员
void CpuPlot::showCurve(QwtPlotItem *item, bool on)
{
item->setVisible(on);
QWidget *w = legend()->find(item);
if ( w && w->inherits("QwtLegendItem") )
((QwtLegendItem *)w)->setChecked(on);


replot();
}
在构造函数中有
showCurve(data[User].curve, true);

问题:红色语句解释下?

我仿造cpuplot例子写了个画温度曲线的,showCurve如下
void com::showCurve(QwtPlotItem *item, bool on)
{
item->setVisible(on);
QWidget *w = ui->qwtPlot->legend()->find(item);
if ( w && w->inherits("QwtLegendItem") )
((QwtLegendItem *)w)->setChecked(on);

ui->qwtPlot->replot();
}
因为界面是在qtdesign中设计的所以增加了ui->qwtPlot->
但是程序执行到紫色代码处出错(提示段错误)
为什么???
离线huifeilove
只看该作者 1楼 发表于: 2011-03-30
同求
快速回复
限100 字节
 
上一个 下一个