PDA

View Full Version : Editing points on QWt Plot



manmohan
25th February 2010, 05:14
Hi every one,
how to edit the points on the qwt plot and acquire the points into a table or array and then replot it. To show the edited data points. Hints will do good.

Please give me some ideas.

Thanks

jomarin
26th February 2010, 08:27
Hi,

Take a look at the event_filter examples in the examples directory.

Maybe it will help ...

Joel.

manmohan
3rd March 2010, 10:23
Thanks for the reply dude.. I will check it out and reply you back in no time...

jomarin
11th March 2010, 08:51
I post my question here because it is related with the issue of editing points on a QwtPlot.

I implemented the possibility to edit points on the QwtPlot like it is made in the event_filter example and it works great for me.
Now, I wonder how I can have both Zoomer and possibility to move the points at the same time ?

Thanks in advance,

Joel.

jomarin
24th March 2010, 10:39
I finally managed to have both CanvasPicker and Zoomer on the same Canvas.

I don't know if it is the best way to do this but at least it works for me.

It is in fact very simple : I added a property in the CanvasPicker class to indicate if I am in selection mode or in zoom mode. This property is set in the CanvasPicker class, for example when Ctrl key is pressed or released.

In selection mode, I act as in the event filter example when MouseButtonClick event occurs.
In zoom mode, I don't do anything in CanvasPicker when MouseButtonClick occurs
In this case, bool CanvasPicker::eventFilter(QObject *object, QEvent *e) returns
QObject::eventFilter(object, e);
and the the signal is handled by the Zoomer.

I hope this can help somebody else ...

jomarin
29th April 2010, 17:49
Today, I went deaper in the comprehension of the Qt eventFilter mecanism. Here is an extract of the Qt documentation :



bool QObject::eventFilter ( QObject * watched, QEvent * e ) [virtual]
Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.


So when a want that a particular event is futher handled by the Zoomer, I return false :D.

I hope this can help somebody else ...

manmohan
14th May 2010, 07:43
i have gone through the event_filter it shows how to edit but I want to save the edited information to a text file or to a table.. how to get the points information from the plot....