Re: Implement selection of multiple points on QwtPlotCurve
<heroor <at> gmail.com>
2012-02-03 13:08:22 GMT
Sent from BlackBerry® on Airtel
-----Original Message-----
From: Sergey <popov <at> ilt.kharkov.ua>
Date: Tue, 31 Jan 2012 13:27:57
To: <qwt-interest <at> lists.sourceforge.net>
Reply-To: List for both Qwt users and developers
<qwt-interest <at> lists.sourceforge.net>
Subject: Re: Implement selection of multiple points on QwtPlotCurve
Thank you, Hendirk!
Just before getting your letter I finished new version of
implementation based completely on the QwtPicker without re-coding
internals. Here is code from my Plot():
//Picker with click point machine to provide point selection
QwtPicker *picker=new QwtPicker(canvas());
picker->setStateMachine(new QwtPickerClickPointMachine);
connect(picker,SIGNAL(appended(QPoint)),SLOT(selectPoint(QPoint)));
//Picker for selecting range of points (Shift+LMB)
QwtPicker *rangePicker=new QwtPicker(canvas());
rangePicker->setStateMachine(new QwtPickerClickPointMachine);
rangePicker->setMousePattern(0,Qt::LeftButton,Qt::SHIFT);
connect(rangePicker,SIGNAL(appended(QPoint)),SLOT(selectRange(QPoint)));
//Picker for append/remove additional points to/from selection (Ctrl+LMB)
QwtPicker *appendPicker=new QwtPicker(canvas());
appendPicker->setStateMachine(new QwtPickerClickPointMachine);
appendPicker->setMousePattern(0,Qt::LeftButton,Qt::CTRL);
connect(appendPicker,SIGNAL(appended(QPoint)),SLOT(appendPoint(QPoint)));
I already had selectPoint, selectRange and appendPoint slots that works
as I want them to work.
Thanks you for your help! I would expand description of QwtPicker class
and send it as patch to Uwe to make documentation better.
Kind regards,
Sergey P.
В Tue, 31 Jan 2012 12:17:37 +0100
Hendrik Vennekate <HVennekate <at> gmx.de> пишет:
> You are very welcome and thanks for considering my suggestion.
> Unfortunately, it is true that the Qwt documentation is sometimes a
> bit meager, but considering the size of the library and the fact that
> Uwe Rathman seems to be the only maintainer, I'd say it's still
> pretty good. In the case of the picker it's -- of course -- even
> worse as its "only" an example and not part of the core library
> (although there is a picker in the core library as well...).
> Sometimes it really helps to look into the code itself instead of the
> documentation ;)
>
> So you want all the comfort, you can get, huh? That's what I do in
> my program (with a less sophisticated point picking), so it should
> work. My guess is that your issue is not to be resolved within Qwt
> but QT itself. Take the documentation of void
> QObject::installEventFilter(QObject *filterObj). There it reads:
> If multiple event filters are installed on a single object,
> the filter that was installed last is activated first.
> In other words: you want to connect the zoomer (connecting via its
> constructor) BEFORE the picker. Alternatively you may want to
> redesign the handling of mouse buttons in the picker to return false
> if a button has been used that is to be passed on to the zoomer (in
> my case I use the middle button for the rectangle and the right to
> zoom out again).
>
> Additionally, you will probably want to modify the zoomer a little.
> I put the following lines into the constructor of my subclass of
> QwtPlotZoomer: setMousePattern(QwtEventPattern::MouseSelect1,
> Qt::MidButton) ; setMousePattern(QwtEventPattern::MouseSelect4,
> Qt::MidButton) ; setMousePattern(QwtEventPattern::MouseSelect2,
> Qt::RightButton, Qt::ControlModifier);
> setMousePattern(QwtEventPattern::MouseSelect3,
> Qt::RightButton); (again: select with mid button and zoom out with
> right button; alternatively, there is also a function that takes
> const QVector<MousePattern>& as argument). This changes the role of
> the mouse buttons. I'd like to refer you to the documentation of
> QwtEventPattern (from which the zoomer inherits) as my memory of what
> I did back then is rather dim...
>
> Best wishes and success,
>
> Hendrik
--
Sergey Popov
B. Verkin Institute for Low Temperature Physics and Engineering
Kharkov, Ukraine
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest