|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map, and context menu. Inline edits to top-level rows enter via commitWatchRootSpec, which the delegate calls through the commit callback set in attach. More...
#include <lua_debugger_watch.h>
Public Slots | |
| void | onExpanded (const QModelIndex &index) |
| void | onCollapsed (const QModelIndex &index) |
| void | showContextMenu (const QPoint &pos) |
Public Member Functions | |
| LuaDebuggerWatchController (LuaDebuggerDialog *host) | |
| void | attach (QTreeView *tree, QStandardItemModel *model) |
| Bind the tree + model and wire all watch-internal signals (typed LuaDbgWatchTreeWidget gestures, expand/collapse, context menu, inline-edit delegate, and the model/selection signals that drive the header buttons attached via attachHeaderButtons). Cross-panel concerns (variables ↔ watch sync) stay with the dialog. | |
| void | attachHeaderButtons (QToolButton *remove, QToolButton *removeAll) |
| Bind the section-header strip. Click signals are wired here; enable/disable state tracks the model and selection. Safe to call before or after attach. | |
| void | configureColumns () const |
| void | pruneExpansionMap () |
| Drop expansion-map entries for watch specs no longer in the tree. | |
| void | restoreExpansionState () |
| Re-expand persisted subpaths after refilling roots from settings. | |
| QStringList | expandedSubpathsForSpec (const QString &rootSpec) const |
Look up expanded descendant keys for rootSpec (may be empty). | |
| void | refillChildren (QStandardItem *item) |
Re-query and replace all children of item. Used by the lazy-expand path and by refreshBranch after pause / step. | |
| void | refreshDisplay () |
| Refresh value/type (and expansion affordances) for all watch roots, recursing into already-expanded branches. Safe to call when no watches exist or when the debugger is not paused (rows fall back to a muted placeholder). | |
| void | refreshBranch (QStandardItem *item) |
Re-evaluate one expanded branch depth-first; preserves the controller-tracked expansion state of nested rows. No-op when item is null or its branch is collapsed. | |
| void | applyItemState (QStandardItem *item, bool liveContext, const QString &muted) |
Apply the per-row presentation for item given the current liveness context. Reads the row state, then dispatches to the matching LuaDebuggerWatchRowPresenter apply* method (the presenter owns cell text / icons / tooltips / change-highlight stamping). | |
| void | insertNewRow (const QString &initialSpec=QString(), bool openEditor=true) |
Insert a top-level watch row; optionally open the inline editor. An empty initialSpec creates a "pending new" row. Otherwise the spec must be a Variables-style path (see wslua_debugger_watch_spec_uses_path_resolution). Duplicates of an existing spec just scroll to the existing row. | |
| void | commitWatchRootSpec (QStandardItem *item, const QString &text) |
| Apply the user's edit of a top-level watch row's expression. | |
| void | deleteRows (const QList< QStandardItem * > &items) |
| Delete the given top-level watch rows from the tree. Children, non-top-level rows and stale pointers are silently ignored. Drops change-highlight baselines for the now-orphaned specs. | |
| void | removeAllTopLevelItems () |
| Confirm with the user, then remove every top-level row. | |
| void | copyValueForItem (QStandardItem *item, const QModelIndex &ix) |
Copy the (untruncated when paused) value of item to the clipboard; shared between the row context menu and the keyboard shortcut. | |
| void | duplicateRootItem (QStandardItem *item) |
Duplicate top-level watch row item below itself. | |
| QList< QStandardItem * > | selectedRootItemsForRemove () const |
| Top-level watch rows in the current selection (column 0) only; used by the section header Remove control. No currentIndex fallback, so the button does not act on a non-selected row. | |
| void | serializeTo (QVariantMap &settingsMap) |
Snapshot the live watch tree as a flat array of canonical spec strings into settingsMap (at the Watches key). Per-row expansion, editor origin, and other runtime state are tracked in QStandardItem data roles only and are not persisted. Also prunes the runtime expansion map to specs that survive in the tree. | |
| void | restoreFrom (const QVariantMap &settingsMap) |
Replace the watch tree with the contents of Watches in settingsMap. Empty / container-typed entries are dropped; scalar values are kept as expression watches even if they are not valid Lua (the next refresh will surface the error). Wipes all watch baselines (variables baselines are kept) so the first refresh starts clean. | |
| void | scheduleDeferredPlaceholder () |
| Schedule a deferred "Watch column shows —" placeholder paint after a step resume. | |
| void | invalidatePlaceholder () |
Cancel the deferred placeholder by bumping the epoch. Call from handlePause() so the imminent refresh wins over a pending post-resume placeholder. | |
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map, and context menu. Inline edits to top-level rows enter via commitWatchRootSpec, which the delegate calls through the commit callback set in attach.
| void LuaDebuggerWatchController::commitWatchRootSpec | ( | QStandardItem * | item, |
| const QString & | text | ||
| ) |
Apply the user's edit of a top-level watch row's expression.
Empty text removes the row (or discards a pending-new row); too-long text shows a warning and is rejected; otherwise the spec is committed, change-highlight baselines for the old and new specs are dropped, and the row is refreshed. Bound to the inline-editor delegate via the commit callback set in attach.
| void LuaDebuggerWatchController::scheduleDeferredPlaceholder | ( | ) |
Schedule a deferred "Watch column shows —" placeholder paint after a step resume.
Bumps an internal epoch and posts a single-shot timer; if a new pause arrives within WATCH_PLACEHOLDER_DEFER_MS, the next call to invalidatePlaceholder bumps the epoch again and the still-pending timer becomes a no-op. Without this defer step a typical fast single-step produces a visible value→—→value blink in every Watch row even when the value did not change.