| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Member Functions | List of all members
LuaDebuggerKeyRouter Class Reference

Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's `eventFilter()`. More...

`#include <lua_debugger_utils.h>`

## Public Member Functions
| LuaDebuggerKeyRouter (LuaDebuggerDialog *host)
| Constructs a LuaDebuggerKeyRouter with a pointer to the host dialog.
void | attach (Ui::LuaDebuggerDialog *ui, QTreeView *breakpointsTree)
| Wire the router to the dialog's Ui struct and breakpoints tree. Must be called once, after `setupUi()` and the programmatic-widget construction in LuaDebuggerDialog::buildAccordionUi.
bool | reserveShortcutOverride (const QKeyEvent *ke) const
| Pre-empt a debugger-owned shortcut on `QEvent::ShortcutOverride`.
bool | handleKeyPress (QObject *obj, const QKeyEvent *ke)
| Handle a `QEvent::KeyPress` delivered to the debugger UI.

## Detailed Description

Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's `eventFilter()`.

The debugger dialog observes key events delivered to any descendant widget so it can:

- Reserve shortcuts that overlap main-window actions before Qt dispatches them to the global QShortcutMap (see reserveShortcutOverride).
- Route subsequent KeyPress events to the right consumer: breakpoint deletion in the breakpoints tree, "toggle breakpoint" and "run to line" inside a focused code view, Esc / Ctrl+Q handling, and finally fall through to the dialog's own QActions for shortcuts that share a sequence with main-window actions (Ctrl+F / Ctrl+S / Ctrl+G / Ctrl+R / Ctrl+W).

Lifetime: owned by the dialog; non-owning pointers to the dialog and its Ui struct (and the breakpoints tree view) are passed via attach() once the `setupUi()` pass has finished.

## Constructor & Destructor Documentation

## ◆ LuaDebuggerKeyRouter()

LuaDebuggerKeyRouter::LuaDebuggerKeyRouter | ( | LuaDebuggerDialog * | host | ) |
| explicit

Constructs a LuaDebuggerKeyRouter with a pointer to the host dialog.

Parameters

  host | Pointer to the LuaDebuggerDialog that owns this key router.

## Member Function Documentation

## ◆ handleKeyPress()

bool LuaDebuggerKeyRouter::handleKeyPress | ( | QObject * | obj,
|  | const QKeyEvent * | ke )

Handle a `QEvent::KeyPress` delivered to the debugger UI.

Returns
  `true` if the event has been consumed (caller's `eventFilter` should return `true`); `false` to fall through to `QDialog::eventFilter`.

## ◆ reserveShortcutOverride()

bool LuaDebuggerKeyRouter::reserveShortcutOverride | ( | const QKeyEvent * | ke | ) | const

Pre-empt a debugger-owned shortcut on `QEvent::ShortcutOverride`.

Returns
  `true` if `ke` matches a shortcut the dialog wants to claim from the main window; the caller should `accept()` the event and return `false` from its `eventFilter` so Qt re-delivers the same key as a KeyPress to this dialog.

The documentation for this class was generated from the following files:

- /builds/wireshark/wireshark/ui/qt/lua_debugger/lua_debugger_utils.h
- /builds/wireshark/wireshark/ui/qt/lua_debugger/lua_debugger_utils.cpp