Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QtWidgets appears behind other windows, and locks current window #65

Open
2 tasks done
alainxi opened this issue Oct 29, 2024 · 0 comments
Open
2 tasks done

QtWidgets appears behind other windows, and locks current window #65

alainxi opened this issue Oct 29, 2024 · 0 comments
Labels
community Issues and PRs coming from the community members

Comments

@alainxi
Copy link

alainxi commented Oct 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior:

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).

Expected Behavior:

Any QtWidgets (volontary ones, or error popups) should display on top of the current window.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

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 :
ynput/OpenPype#6016
ynput/OpenPype#4304

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.

I have found a hack to make it work in Blender :

from ayon_core.tools.utils import host_tools
loaderGui_window = host_tools.get_tool_by_name("loader")
choice = QtWidgets.QMessageBox.warning(loaderGui_window, ............

(I have replaced None by loaderGui_window)

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.

Are there any labels you wish to add?

  • I have added the relevant labels to the bug report.

Relevant log output:

No response

Additional context:

No response

@MustafaJafar MustafaJafar added the community Issues and PRs coming from the community members label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members
Projects
None yet
Development

No branches or pull requests

2 participants