I know what you are trying to do. But you don't do it correctly.
You could modify that example to fit your need.
In mouseMoveEvent, just set the correct geometry.

I use eventFilter coz it is a continous loop until the user releases the mouse where I exit the loop.
It is a loop anyway, and mouseMoveEvent will get called repeatedly.

Returning TRUE always in event() is your biggest mistake. You block all the events, like paint() - This is why the QRubberBand doesn't gets painted - it's parent doesn't get a paint event, therefore neither does the rubber band.

Use the standard event handlers and stop using enter_loop and exit_loop - the Qt event loop works fine, you don't need to force it in doing things.

Try my suggestion and it will work!

regards