Damn, I really thought that would do the trick.
Though I found out that I hadn't been correct before, saying that QEvent.ZOrderChange fires every time.
There seems to be one event, which is when clicking the window titlebar, that is super crazy.
It fires QEvent.NonClientAreaMouseButtonPress and puts that QWidget in front.
But only if I click very fast, a slow click doesn't put it in front.
And when clicking fast, calling raise_() on the other QWidget doesn't help.
It overrides it, or switches windows at some later mouserelease event or something. QEvent.NonClientAreaMouseButtonRelease is NOT fired.
(QEvent.NonClientAreaMouseButtonRelease actually fires sometimes, but it doesn't help to call raise_() at that time either)
- Are there any events that I'm missing? I've overridden event() to print "all" events, but that doesn't seem to be all.
- Or can it be some kind of thread/event-order problem? (Is it possible that the windows switching happens after, not "during", the QEvent.NonClientAreaMouseButtonPress event?)