Hello,
I am developing an application using qwtplot to continuiously take the coordinates from the curser position and then plot the amplitude of the sine curve.
T get the cursor position, I am using :
QCursor *mycurser = new QCursor;
pos_global = mycurser->pos();
pos_local = this->mapFromGlobal(pos_global);
Pos_local gives me the coordinates in integers, I dont know if they are called pixel coordinates. I wanted to get the coordinates with reference to myplot, so thats why I used following function:
QPointF plot::myinvTransform( const QPoint &pos ) const
{
QwtScaleMap xMap = this->canvasMap( this->xBottom );
QwtScaleMap yMap = this->canvasMap( this->yLeft );
return QPointF(
xMap.invTransform( pos.x() ),
yMap.invTransform( pos.y() )
);
}
and I call the function after specific interval with my curserposition as:
QPoint pointPlot = myinvTransform( pos_local);
I am getting the mapped coordinates but they are not accurate. There is a little offset in both the x and y positions.
Anyone have any idea please help me. Or if you don;t understand my problem, just ask me, i will reply very fast.
Bookmarks