How could I display the pos(x,y) of the axis designed by QwtPlot under the mouse ?
Hello, I want to display the pos(x,y) of the Axis draw by the class QwtPlot when my mouse drags, which works only when the mouse is in the axis area . My code is as follow:
QwtPlotCanvas *canva = new QwtPlotCanvas(this);
picker = new QwtPlotPicker(QwtPlot::xBottom,QwtPlot::yLeft,canv a);
picker->setStateMachine(new QwtPickerTrackerMachine);
picker->setTrackerMode(QwtPicker::AlwaysOn);
But in fact, only a small area on the top left corner can display the pos(x,y) of the window instead of the axis which is really I want. Who can tell me what is wrong with my code? Thank you ï¼
Re: How could I display the pos(x,y) of the axis designed by QwtPlot under the mouse
When using Qwt from SVN trunk you have to insert the local canvas into a plot widget.
For all other versions of Qwt the code above makes no sense, because you can't insert a local canvas - instead plot->canvas() needs to be the parent of your picker.
Uwe
Re: How could I display the pos(x,y) of the axis designed by QwtPlot under the mouse
Quote:
Originally Posted by
Uwe
When using Qwt from SVN trunk you have to insert the local canvas into a plot widget.
For all other versions of Qwt the code above makes no sense, because you can't insert a local canvas - instead plot->canvas() needs to be the parent of your picker.
Uwe
I used qwt6.0,How can I judge whether it is from SVN trunk?And how to insert the local canvas into a plot widget? I tried to insert a line of code"picker->setParent(this->canvas());",it worked worse, I can't get the pos(x,y)even on the left top corner. Thank You!
Re: How could I display the pos(x,y) of the axis designed by QwtPlot under the mouse
Quote:
I used qwt6.0,How can I judge whether it is from SVN trunk?
SVN trunk = Qwt 6.1.
Quote:
And how to insert the local canvas into a plot widget?
You can't. Instead your code has to be:
Check the examples how to use picker/zoomer objects.
Quote:
I tried to insert a line of code"picker->setParent(this->canvas());",it worked worse, ...
Of course - a second canvas not known by any layout and completely unrelated to the plot coordinate system ...
Uwe
Re: How could I display the pos(x,y) of the axis designed by QwtPlot under the mouse
I get it ! Thank you very much!
Added after 39 minutes:
Quote:
Originally Posted by
Uwe
SVN trunk = Qwt 6.1.
You can't. Instead your code has to be:
Check the examples how to use picker/zoomer objects.
Of course - a second canvas not known by any layout and completely unrelated to the plot coordinate system ...
Uwe
Then how can I just display the integer ones of x axis?For I want to draw some histograms on the plot,and then display the value of the histograms.