Quote Originally Posted by jpn
It's the OS which is responsible for sending appropriate events. There are separate mouse and focus in/out events. A single mouse event doesn't cause all other appropriate events to be sent (compared to the situation what happens upon a mouse click).

QWidget offers methods for setting focus and QLineEdit (or QTextCursor) offers methods for setting cursor position. Don't try to re-invent a wheel..
Quote Originally Posted by wysota
Because it is QFocusEvent's responsibility.

But ... here's what I'm trying to achieve: I am trying to write automatic unit tests for my widgets by "simulating" the user interaction with the widget. E.g. for a left mouse press I am sending a MousePress event to the widget. Are you saying that's not enough? Are you saying that I cannot automate the simulation of the user interaction with the widget?