Walk a QMenu's actions WITHOUT the isVisible() gate, descending into submenus, so a menu-bar leaf action is reachable even while its menu is closed. The owning QMenu is returned so triggerMenuAction() can route through the closed-menu (action->trigger()) path. (#3646 fidelity — items 5 + 7)
| 631 | // closed. The owning QMenu is returned so triggerMenuAction() can route through |
| 632 | // the closed-menu (action->trigger()) path. (#3646 fidelity — items 5 + 7) |
| 633 | ResolvedAction matchMenuActionUnconditional(QMenu* menu, const QString& target) |
| 634 | { |
| 635 | for (QAction* action : menu->actions()) { |
| 636 | if (action->isSeparator()) |
| 637 | continue; |
| 638 | if (actionMatchesTarget(action, target)) |
| 639 | return {action, menu}; |
| 640 | if (QMenu* submenu = action->menu()) { |
| 641 | const ResolvedAction match = matchMenuActionUnconditional(submenu, target); |
| 642 | if (match.action) |
| 643 | return match; |
| 644 | } |
| 645 | } |
| 646 | return {}; |
| 647 | } |
| 648 | |
| 649 | // Resolve a QAction anywhere in any top-level window's menu bar, regardless of |
| 650 | // whether the menu is currently open. This is what lets `invoke` drive |
no test coverage detected