c++ - Qt. Making a QGraphicsItem follow cursor at all times -
i wish make custom graphics item follow cursor without needing clicked on. view has setmousetracking(true)
, graphics item has setflag(itemismovable, true); setaccepthoverevents(true);
, doesn't track cursor, have click , drag it. proper way make qgraphicsitem
follow cursor?
you can capture mouse event on item if cursor pass above it. example, instead of clicking on item, can react on mousemove events.
but seem want more global behaviour. track mousemoveevent
directly on qgraphicsview (or on qgraphicsscene if have multiple views) (see mousemoveevent). after that, keep reference on item , make move each time intercept event