A problem about parent widget and mouse event capture
-
I am a qt beginner and when I am working with qt, I am trying to put a custom widget into another widget \ drag it out of another widget, this works fine without nesting, but when I click on a sub Widget2 in a sub Widget1 in a MainWindow, the sub Widget2 I click on responds to the MousePressEvent and responds normally to a MouseMoveEvent.But if I set Widget2 to be a child Widget of MainWindow in the MousePressEvent function, it doesn't respond to a MouseMoveEvent and a MousePressEvent(Widget2 or MainWindow either).When I release the mouse or click once elsewhere and move the mouse back into its range, it can respond to MouseMoveEvent again (setMouseTracking to true)
more imformation in gif(normal setMouseTrackingFalse setMouseTrackingTrue1 setMouseTrackingTrue2)