成员
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->
但是程序执行到紫色代码处出错(提示段错误)
为什么???