PDA

View Full Version : Plot Picker x=0



sun
6th October 2008, 16:39
Hi,

I have now integrated a PlotPicker in my QwtPlot and coded a function which should set the picked x and y location in two QLabes:


void MainWindow::valuePlotPickerSelected( const QwtDoublePoint& point)
{
QString temp; temp.setNum(point.x());
valuePlotX->setText(temp); temp.setNum(point.y());
valuePlotY->setText(temp);
}

This seems to work most of the time. But when I don't replot or even sometimes when i replot it sets the x value to 0.
Y value is allways correct, but I sometimes can pick many points and it is sheer luck if the x value is correct or 0.

What could the problem be? Is it a problem, that there can be less x values than I have pixels on the QwtPlot?

Thanks for taking the time!
sun

Uwe
6th October 2008, 22:57
Assuming, that MainWindow::valuePlotPickerSelected is connected to the selected signal of a QwtPlotPicker in PointSelection mode: in QwtPlotPicker::end() line 289 the pixel position is translated into plot coordinates. Check, what's going wrong there.

Uwe

sun
7th October 2008, 08:43
Thanks for the fast help!

I'll try it sometime. It's not first priority at the moment.