View Full Version : How to keep the mouse event?

27th October 2009, 08:54
I have a QMainWindow, its center widget is used to draw figures(with mouse) , and one toolbar which has a QLineEdit.

The perfect behavior is that if Tab pressed, the focus will jump to the lineEdit in the toolbar, the lineEdit will have the focus, but the center widget will still receivee the mouse event.

The situation is that the lineEdit do have foucs after the tab is pressed,
but the center widget will not receive mouse event( because it lost the focus)

I think this is a very hard problem, Is there any way to solve this problem?

Thanks in advance:)

27th October 2009, 10:48
You could make the line edit a focus proxy of the canvas. Mouse input is not really related to focus but rather with activation. On some systems this is the same, on others this differs. Try the focus proxy or set the focus policy of the canvas to NoFocus.