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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -