Open lukasc-ubc opened 4 days ago
Hello @lukasc-ubc,
The behavior changed in 0.29.2
, which is macOS-specific.
Document ===> https://www.klayout.de/doc-qt5/about/macro_in_menu.html
The report that prompted the fix ===> https://github.com/KLayout/klayout/issues/1722
Thank you. Given that it worked previously, would there be a way to return that functionality? Or is it a major change in Qt that prevents this moving forward?
Hi @Kazzz-S - thanks for the pointer. I already forgot that issue ...
@lukasc-ubc Problem was that it was possible to add menu items, but when they get removed (which is a valid operation), KLayout crashed on MacOS. The "Extra" menu (with the three dots) as a container for dynamic content was the only feasible solution I found during long debugging sessions via a remote connection. I don't know if it is a Qt bug or some more general limitation, but it appears that it is not possible to dynamically reconfigure the application's top level menu - at least when it comes to removing items.
Matthias
Perhaps instead, 1) disable the “remove” option for Mac OSX. 2) leave the “…” Extra menu in case people want to dynamically remove things. Or those that want to remove, can themselves create a “…” menu item.
I suspect adding to the menu is a much more common operation than removing from the menu?
Thank you
On Oct 18, 2024, at 4:14 PM, Matthias Köfferlein @.***> wrote:
Hi @Kazzz-S https://github.com/Kazzz-S - thanks for the pointer. I already forgot that issue ...
@lukasc-ubc https://github.com/lukasc-ubc Problem was that it was possible to add menu items, but when they get removed (which is a valid operation), KLayout crashed on MacOS. The "Extra" menu (with the three dots) as a container for dynamic content was the only feasible solution I found during long debugging sessions via a remote connection. I don't know if it is a Qt bug or some more general limitation, but it appears that it is not possible to dynamically reconfigure the application's top level menu - at least when it comes to removing items.
Matthias
— Reply to this email directly, view it on GitHub https://github.com/KLayout/klayout/issues/1897#issuecomment-2423356555, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADY37AFRYJIPID2E5BFUOM3Z4GI3RAVCNFSM6AAAAABQEME3WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRTGM2TMNJVGU. You are receiving this because you were mentioned.
There are actually a number of practical issues. Thing is, dynamic menus work perfectly fine on other platforms, so this feature is being used.
I really spent a lot of time trying to bring the behavior to MacOS including attempts to disable them instead of removing them. I could not get it stable.
Menus are dynamic not only because they are explicitly removed, but also when you remove macros or change a macro's menu binding for.example. So it's not enough to simply disable "remove".
Maybe someone with a deeper insight into.Qt's MacOS binding than me could take a look. If there is a way to bring the original behavior to MacOS in a stable way, I'll be happy to adopt that solution.
Matthias
Hi Matthias,
I notice that the custom menu I added doesn't show up in the display in the newer version. Is this an intentional change, and is there a way to have it appear like it did in the 0.29.1, as per below?
KLayout 0.29.1 menu bar:
KLayout 0.29.6 menu bar:
This is implemented using:
I checked the documentation and couldn't find anything suggesting this should not be possible: https://www.klayout.de/doc-qt5/code/class_AbstractMenu.html
Could it be this change? https://github.com/KLayout/klayout/commit/11139cd4da6045235e91b6c1ecc479cbbc46a39a
thank you