the Even_filter example is all what you need,
in this example it does select the curve, in the select method,
in these lines:
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
{
QwtPlotCurve *c
= static_cast<QwtPlotCurve
*>
( *it
);
/// c is the curve you clicked on
double d;
int idx = c->closestPoint( pos, &d );
if ( d < dist )
{
curve = c;
index = idx;
dist = d;
}
}
for ( QwtPlotItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve )
{
QwtPlotCurve *c = static_cast<QwtPlotCurve *>( *it ); /// c is the curve you clicked on
double d;
int idx = c->closestPoint( pos, &d );
if ( d < dist )
{
curve = c;
index = idx;
dist = d;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks