PDA

View Full Version : Qt Polar Plot don't send correct Pole position...



sampad1370
5th March 2016, 12:32
hi
excuse me for bad English!
i'm beginner in Qt Polar Plot and i need to calculate position of cursor in Polar screen so i use pole position.
i map cursor position to widget position and i aum with polar screen that result have error!
this error is change with change width/height!
how solve this problem?

sampad1370
8th March 2016, 08:49
Hi
I fix this error with add two line in mapping cursor to polar screen:

double dx=((QwtPolarPlot*)(m_polarWidget))->width()-canvasRect.width();
double dy=((QwtPolarPlot*)(m_polarWidget))->height()-canvasRect.height();
m_position=m_polarWidget->mapFromGlobal(QCursor::pos());
auto Position=QPointF(m_position.x()-(pole.x()+dx/2),(pole.y())-m_position.y())/(m_zoomScale.x()*scale);

but i have another Question that is :
this answer must scale in x/y to correct in polar screen,how find this scale number?
Please Help me....
thanks.

Uwe
8th March 2016, 11:42
Mapping between polar and widget coordinates can be done using the QwtScaleMaps - see QwtPolarPlot::canvasMap(). But note the widget coordinates are positions of the plot canvas ( see QwtPolarPlot::canvas() ).

Uwe

sampad1370
8th March 2016, 13:28
thanks for answer me
I try and go back...

Added after 14 minutes:

Hi again...
i see two subject but :
1- Can't find QwtPolarPlot::canvasMap() Function!
2- I need to scale Global Position of cursor and do this for regular widget but for this widget i must calculate scale number to correct this process,in this progress,i can't find scale than normal render with painter!
how solve this Ooops problem!
please help me... :crying:
thanks...

Uwe
8th March 2016, 13:54
It's QwtPolarMap::scaleMap().

Uwe

sampad1370
8th March 2016, 15:36
Hi
thanks for help me.
I Found this class but when i map shap in position(x,y) to polar plot screen,position don't correct!
please show me with code and help me more please...
thanks.

sampad1370
9th March 2016, 07:55
Hi
Thanks again for help me and reference me to solve this problem.
I finally solve this problem.
have good time.
a.a