mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-25 09:28:04 +00:00
Previously there were two kinds of Menu: 1. "Simple" menu that don't have any `if` or `for` 2. "Complex" menu that have `if` and `for` For the first kind, we were generating in the compiler the `entries` and `sub-menu` callback. This lead to more efficient and simple code at runtime. For the second kind, we generate an item tree so we can dynamically produce them at runtime. The issue is that as we added feature, the code became complex to handle, even in the simple case as we need to create a `VRc<MenuVTable>` also for the context menu so we can have native context menu. We still need the "Simple" case for the internal though. So for that I added a ShowPopupMenuInternal builtin function although it only differ from ShowPopupMenu by the type of its second argument. Since the generated code has lots in common, they are still handled together. The proof that the two different codepath were harmful is that removing it showed a bug with contextmenu within repeated element. the `contextmenu_delete.slint` started failling. It worked before because it was only a problem with "Complex" menu and the test used a "Simple" menu. The change in the interpreter should also solve the issue #9031 which were using the wrong item tree as the menu. |
||
|---|---|---|
| .. | ||
| optim_passes | ||
| expression.rs | ||
| item_tree.rs | ||
| lower_expression.rs | ||
| lower_to_item_tree.rs | ||
| pretty_print.rs | ||