c++ - QGraphicsWidget's mouse drag. -


how implement mouse draging on qgraphicswidget?

i tried with

setflag(qgraphicsitem::itemismovable); 

and works sometime (?)

enter image description here

for example, node 6 can move mouse, rest of nodes wont move.

also, how can implement when move node, edge attached node move it.

the real reason may have not provided override of shape() function. function used define "collision" geometry: parts of object can click on. if inherrit qgraphicsitem directly, seems work fine without providing definition, qgraphicswidget overrides shape() function , returns qwidget::rect() (which may not defined in class), default implementation qgraphicsitem isn't being used anymore when inherit qgraphicswidget!

if provide definition of shape function returns ellipse surrounds circle draw node, bet might start working. example:

qpainterpath mygraphicswidget::shape() const {     qpainterpath path;     path.addellipse(qpointf(0, 0), 25, 25);     return path; } 

this may old question, spent 3 hours trying figure out, myself. answer useful out there if not ;)


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -