PDA

View Full Version : no matching function for call to 'PlotPicker::invTransform(QPointF)'



fatecasino
24th April 2015, 03:06
Hi,
I am new to C++ and QT, I am trying to use qwt plot picker with invTrasform, but I cannot manage it. User draws a rectangular with the mouse on the plot and I try to get the actual x,y coordinates.

I created a plot picker:


picker = new PlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,QwtPicker::RectRubberBand, QwtPicker::AlwaysOn, myPlot->canvas());

I am trying to get the coordinates from a QRect that the user draws with mouse


connect(continuum_picker, SIGNAL(selected(QRectF&)), this, SLOT(onContinuumAreaSelected(const QRectF&)));

Implementing the SLOT

void my2dPlot::onContinuumAreaSelected(const QRectF& selectedRect)
{
...
float w = QwtPlotPicker::invTransform(selectedRect.bottomRig ht()).x();

....
}

I get the error:

error: no matching function for call to 'PlotPicker::invTransform(QPointF)'
candidates are: QRectF QwtPlotPicker::invTransform(const QRect&) const
note: QPointF QwtPlotPicker::invTransform(const QPoint&) const

Any ideas?

wysota
24th April 2015, 06:15
The function expects a rectangle and not a point.

fatecasino
24th April 2015, 15:47
thank you very much, it was so obvious, but after some hours you can't really see the simplest things( perhaps in life too :cool: )
Today I realised that the selected(QRectF&) SIGNAL, sends the actual plot points to the slot and not the mouse position (that should later be converted to plot points with invTransform())


QPointF tempPoint(selectedRect.bottomRight().x(), selectedRect.bottomRight().y() ) ;

but there is some kind of magic here. While debugging I see that when you call the bottomRight() you receive the topRight() and when you call the bottomLeft() you get the topLeft()!!
Is it possible? Does it have to do with the way the user makes the rect on screen?
I am using Qwt-6.0.0-rc5.