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

Breaking change related to QMenu in 2.4.2 #505

Closed
astrofrog opened this issue Dec 4, 2024 · 2 comments · Fixed by #507
Closed

Breaking change related to QMenu in 2.4.2 #505

astrofrog opened this issue Dec 4, 2024 · 2 comments · Fixed by #507
Assignees
Labels
Milestone

Comments

@astrofrog
Copy link
Contributor

astrofrog commented Dec 4, 2024

Prior to QtPy 2.4.2, the following:

from qtpy.QtWidgets import QApplication, QMenu

app = QApplication([])

menu = QMenu()
menu.addMenu('test')

submenu = menu.children()[1]

print(isinstance(submenu, QMenu))

would return True, but now returns False because the class for menus added using addMenu is the native QMenu class whereas QtPy now exposes a wrapped class. Fixing this might be a matter of overriding addMenu?

@axel-kah
Copy link

This issue hit us by surprise as well and broke our application in a very interesting way. Maybe the implications were not apparent at the time, but at least in hindsight, introducing these wrapper classes seems to break fundamental Qt functionality (eg. Qbject.findChild() et. al) and should have been handled like a major change.

The change in question seems to have been introduced with #461

Would be great to get some guidance on how to deal with the situation. Will this change be rolled back or is there advice on how to make findChild() work again?

@dalthviz
Copy link
Member

Hi @astrofrog thanks for the report! I think as @axel-kah mentions we could revert adding those wrappers (I though they were necessary but after some checks seems like that is not the case). Working on it over #507 ! If you have further thoughs about this let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants