C++ (Qt)void YourGraphicsView::drawForeground( QPainter* painter, const QRectF& rect ){ QGraphicsView::drawForeground( painter, rect ); if( yourDrawRect.intersects( rect ) ) // your mouse painting ...}
C++ (Qt)void YourGraphicsView::mousePressEvent( QMouseEvent* e ){ QPoint p( mapToScene( e->pos() ).toPoint() ); QGraphicsItem* item = itemAt( p ); if( item ) item->update();}
C++ (Qt)QGraphicsView::mouseMoveEvent(event);QGraphicsItem * item = scene()->mouseGrabberItem();