hello,
i was observing the cpu plot example. On executing the binary i noticed that the "user" and the "system" legend items were already checked and the corresponding curves were shown. However i would like only one curve to be shown when the widget starts.
1. How do i change this default behavior ?
2. Secondly, when a legend item is clicked..say "total" i would like the previous selection to be unchecked automatically. This does not happen in the example.
The code looks something like this:
connect(this,
SIGNAL(legendChecked
(QwtPlotItem *,
bool)),
connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)),
SLOT(showCurve(QwtPlotItem *, bool)));
To copy to clipboard, switch view to plain text mode
and
{
item->setVisible(on);
if ( w && w->inherits("QwtLegendItem") )
replot();
}
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();
}
To copy to clipboard, switch view to plain text mode
Bookmarks