[Interest] two QGraphicsView for the same QGraphicsScene main ans auxiliary, to simulate a magnifier lens

Francisco Ares frares at gmail.com
Wed Jan 30 19:41:20 CET 2013


Hi,

I am writing a piece of code for camera calibration (pixels/inch or
equivalent): I have an image of a multiple printed marks and a few
QGraphicsSvgItem targets to be moved on top of each printed mark for
distance measurement, in pixels, and as I know previously the real distance
of those marks, I can calibrate the camera.

I started with a QGraphicsView and a QGraphicsScene containing a QPixmap
and those QGraphicsSvgItem movable targets.  So far, so good, it is pretty
simple and it works.

But then I came up with the idea of increasing a bit the precision, using
something like a magnifier lens. So I added a second scaled QGraphicsView
for the same QGraphicsScene that already contained the image and the
movable targets. The basic idea was that this QGraphicsView should move
along with the movable targets.

But now I have two mouse events (at least) for each real physical event,
making the movement of the SVG target and the second QGraphicsView
recursive and infinite.

The temporary solution was to update the position of that second
QGraphicsView only in "mousePressEvent" and in "mouseReleaseEvent", and no
in "mouseMoveEvent".

Is there a way of filtering from where the "mouseMoveEvent" comes from? Or
any other idea?

Thanks
-- 
Francisco
"If you have an apple and I have an apple and we exchange apples then you
and I will still each have one apple. But if you have an idea and I have
one idea and we exchange these ideas, then each of us will have two ideas."
- George Bernard Shaw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130130/8c6c379c/attachment.html>


More information about the Interest mailing list