In case it helps others, here is a problem, and the dirty workaround I use (until it is fixed).
From a Blender load addon, I want to display a Qt popup in front of Ayon’s Load gui
So, I tried this :
from qtpy import QtWidgets
choice = QtWidgets.QMessageBox.warning(None,
"The title",
"The message",
buttons = QtWidgets.QMessageBox.Ok,
defaultButton = QtWidgets.QMessageBox.Ok)
Problem : the popup appears behind the Load gui (which is obviously frozen because it waits for the user to click on the popup).
And you can’t Alt-Tab to switch to that pop-up (you still get the Load gui).
The good news : the popup displays the correct information (I can see it in the minimized windows that appear as part of the Alt-Tab process).
It bugs today in Ayon with Blender 4.0.2 / PySide 6.
It already bugged a year ago in OpenPype with Blender 3.3.2 / PySide 2 :
That’s when I try to display a popup on purpose.
Now, let’s try to display a popup as the result of an error.
So, I take an Ayon addon for Blender (for example a Load addon), and I add any obvious python syntax error (not even related to Qt).
A standard Qt popup that displays the error will appear behind the current Ayon gui, and you can’t reach that popup.
Now the popup appears in front of the Ayon–>Load gui (and not behind anymore).
But it only works for a popup I code in my own addon, it obviously doesn’t work for popups that result of an error (as decribed earlier).
And it’s strange I have to specify the parent (other DCCs Load addons have the same kind of QtWidgets.QMessageBox that work all right with None as the parent).
Also, I’m not sure calling get_tool_by_name (to get the parent QtWidget) is a clean method.