thanks a lot for your reply,i know you must be busy.I followed your advice and:
showCurve(data[System].curve,true);
showCurve(data[User].curve, false);
showCurve(data[Total].curve, false);
showCurve(data[Idle].curve, false);
showCurve(data[System].curve,true);
showCurve(data[User].curve, false);
showCurve(data[Total].curve, false);
showCurve(data[Idle].curve, false);
To copy to clipboard, switch view to plain text mode
this should ensure that i get only the system curve at the beginning.Next:
{
const QwtPlotItemList &list = this->itemList();
for (QwtPlotItemIterator it = list.begin();it!=list.end();++it)
{
item2->setVisible(false);
}
item->setVisible(on);
if ( w && w->inherits("QwtLegendItem") )
replot();
}
void CpuPlot::showCurve(QwtPlotItem *item, bool on)
{
const QwtPlotItemList &list = this->itemList();
for (QwtPlotItemIterator it = list.begin();it!=list.end();++it)
{
QwtPlotItem *item2 = *it;
if (item2->rtti() == QwtPlotItem::Rtti_PlotCurve)
item2->setVisible(false);
}
item->setVisible(on);
QWidget *w = legend()->find(item);
if ( w && w->inherits("QwtLegendItem") )
((QwtLegendItem *)w)->setChecked(on);
replot();
}
To copy to clipboard, switch view to plain text mode
this removes a curve when the legend item is checked and displays the new curve.
however i don't see the system curve at the start of the application...even though its legend item is checked.
Bookmarks