View Full Version : Plot Picker x=0

6th October 2008, 15:39

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());

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!

6th October 2008, 21: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.


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

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