- You have hidden your Game widget.
- Your graphicsView does not have a parent, so it is the top level widget.
- You are implementing mouseMoveEvent on the Game widget (which is hidden!) so of course you won't receive the event.
First thing:
- Replace w.setVisible(false) from your main function with w.show()
- Make graphics view the child of Game widget. i.e. replace view = new QGraphicsView; with view = new QGraphicsView(this); If you do this you don't need to show the view manually as you are currently doing.
Once the parent child hierarchy is fixed, you should start getting the mouse events and you can move your rectangle!
Regards
Vikram




Reply With Quote

Bookmarks