|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Inline editor for the Breakpoints "Location" column. More...
#include <lua_debugger_breakpoints.h>
Public Member Functions | |
| BreakpointInlineLineEdit (QWidget *parent=nullptr) | |
| void | setEmbeddedWidgets (QComboBox *modeCombo, QComboBox *hitModeCombo, QToolButton *pauseButton) |
| void | relayout () |
Protected Member Functions | |
| void | resizeEvent (QResizeEvent *e) override |
| void | showEvent (QShowEvent *e) override |
| void | paintEvent (QPaintEvent *e) override |
Inline editor for the Breakpoints "Location" column.
The editor IS a QLineEdit, exactly like the Watch tree's editor — same widget class, same parent chain (direct child of the view's viewport), same native rendering on every platform. This is what makes the Breakpoint edit field render at QLineEdit::sizeHint() height with the platform's native frame, focus ring, padding and selection colours, pixel-identical to the Watch edit field.
The earlier implementation wrapped the line edit inside QStackedWidget inside QHBoxLayout inside a wrapper QWidget; with that nesting the layout sized the QLineEdit to whatever the row was (never to its own natural sizeHint), so on macOS the QMacStyle frame painter drew a much shorter line edit than the Watch tree's bare QLineEdit, even when the row itself was the same height. Embedding the auxiliary controls as children of the QLineEdit and reserving space with setTextMargins() lets the line edit be the editor while keeping sizing consistent with the Watch tree.
The mode combo lives on the left edge; the hit-count comparison combo and the "also pause" toggle live on the right edge, hidden by default and shown only for the modes that own them. Caller (LuaDbgBreakpointConditionDelegate::createEditor) wires up the mode-change behaviour, the focus / commit logic and the model read/write; this class is intentionally only responsible for the geometry of the embedded widgets and the corresponding text margins.
| void BreakpointInlineLineEdit::relayout | ( | ) |
Re-run the geometry pass — call after toggling the visibility of any embedded widget so the text margins (and therefore the caret-claim area) follow.
Bails out when the editor has no real width yet (called e.g. from setEmbeddedWidgets or the mode-applier before QAbstractItemView has placed us in the cell): with width()==0 every right-anchored widget would land at a negative x. The first real layout pass happens via resizeEvent once the view sets our geometry, and a final pass via showEvent picks up any visibility changes that landed after that.
| void BreakpointInlineLineEdit::setEmbeddedWidgets | ( | QComboBox * | modeCombo, |
| QComboBox * | hitModeCombo, | ||
| QToolButton * | pauseButton | ||
| ) |
Hand the editor its three embedded widgets (already parented to this by the caller) so it can reserve text-margin space for them and reposition them on every resize.