
Originally Posted by
oddytz1989
Could you tell what I need to fix?
Sorry I wrote nonsense of course QwtPlotCurve::closestPoint want a point in widget coordinates. You have to write something like this:
connect( picker,
SIGNAL( selected
( const QPolygon & ),
SLOT(UpdVizir
( const QPolygon & )));
connect( picker, SIGNAL( selected( const QPolygon & ), SLOT(UpdVizir( const QPolygon & )));
To copy to clipboard, switch view to plain text mode
and
void TrendTop
::UpdVizir( const QPolygon &points
) {
if ( points.size() != 1 )
return; // should never happen for point selections
double dist;
int index = curv1->closestPoint( points[0], &dist );
if ( index >= 0 && dist <= ... )
{
const QPointF found
= curv1
->sample
( index
);
....
}
}
void TrendTop::UpdVizir( const QPolygon &points )
{
if ( points.size() != 1 )
return; // should never happen for point selections
double dist;
int index = curv1->closestPoint( points[0], &dist );
if ( index >= 0 && dist <= ... )
{
const QPointF found = curv1->sample( index );
....
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks