[Qt-interest] mouse and polygons
John McClurkin
jwm at nei.nih.gov
Thu Nov 18 13:42:23 CET 2010
Mahendra G.R wrote:
> Hey Alex,
>
> Thanks for your reply, 4points, i just made it for debugging purposes,
> problem is, the application is already heavy on cpu which makes the gui
> slower, and when i move the mouse it is really slow, i think there is
> some problem with my mouseMove function, i dont know what iäm doing
> wrong, and yes, i'm pretty new to c++ as well. Sorry i didnt get your
> suggestion, can you explain it again.
>
>
> I have implemented drawing polygons in a scene using QpolygonF,
> QGraphicsPolygonItem and QgraphicsScene. When i click on the scene,
> i collect the points and create a polygon on the double click, until
> here its fine. When i move/drag the polygon it does move. But the
> problem is, i have a huge data set, and when i move the polygon with
> this dataset in the background, polygon moves slowly, and when the
> cursor goes out of the polygon, i get a segmentaion fault, how
> should i restrict cursor to be inside the polygon item or is there a
> better solution for this?
I'll repeat Alex's suggestions in a simple form.
You can't restrict the cursor to stay in the polygon.
So, run your program in a debugger, let it crash, then examine the stack
trace to see what part of your code is causing problems. Finally,
redesign your code to avoid the crash.
These skills are essential to any programing, not just C++.
More information about the Qt-interest-old
mailing list