I am trying to send the custom event to an existing QGraphicsScene to remove the first occurrence in the scene with the desired location From now on, all other events go to the same place (as the first event) even if they are provided with other places after manually clicking inside this scene, this "restart" Happens "and the next custom event is in the right place Is accepted (all others still go to the wrong place).
My code:
qreal view x = customX; Qreal view Y = customY; QGraphicsView * View = m_scene-> Views () [0]; QPoint ptView = Scene-> MapFrussen (ViewX, Visual Y); QPoint ptGlobal = View-> Viewport () - & gt; MapToggle (ptView); QGraphicsSceneMouseEvent Event (QEvent :: GraphicsSceneMouseRelease); Event.setScenePos (QPoint (sceneX, View Y)); Event.setPos (QPoint (sceneX, View Y)); Event.setScreenPos (ptGlobal); Event.setButton (QT :: LeftButton); Event.setButtons (QT :: LeftButton); Event.setModifiers (QApplication :: keyboardModifiers ()); QApp- & gt; Send events (m_scene, and events);
Custom X and CustomWare are just arbitrary X and Y, which are generated when I fly. I send sample codes several times with different customX and custom u.
Found!
Finally, this line was to be added: m_scene-> MouseGrabber Itam () -> Argmobause ();
Comments
Post a Comment