Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
lua_debugger_utils.h File Reference
#include <QBrush>
#include <QChar>
#include <QColor>
#include <QFont>
#include <QHash>
#include <QIcon>
#include <QKeySequence>
#include <QModelIndex>
#include <QSet>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QString>
#include <QStringList>
#include <QTreeView>
#include <QVariant>
#include <QtGlobal>
#include "epan/wslua/wslua_debugger.h"

Go to the source code of this file.

Classes

struct  LuaDbgTreeSectionExpansionState
 
struct  LuaDebuggerPath::LuaDbgInvalidFilterColors
 
struct  LuaDebuggerPath::VariableRowFields
 
class  LuaDebuggerKeyRouter
 Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's eventFilter(). More...
 
class  LuaDebuggerChangeHighlightTracker
 "Value changed since last pause" highlighter for the Watch and Variables trees. More...
 

Typedefs

using LuaDebuggerPath::TreePathKeyFinder = QStandardItem *(*)(QStandardItem *, const QString &)
 

Enumerations

enum class  LuaDbgBpHeaderIconMode { NoBreakpoints , ActivateAll , DeactivateAll }
 Controls the state of the header toggle icon in the Lua debugger breakpoint list. More...
 

Functions

QStandardItem * luaDbgWatchRootItem (QStandardItem *item)
 Finds the root item of a QStandardItem hierarchy.
 
void luaDbgRecordTreeSectionRootExpansion (QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey, bool expanded)
 Record / clear root-level expansion for rootKey in map. Mutates map in place; collapsing a root with no remembered subpaths drops the entry entirely so the map stays minimal.
 
void luaDbgRecordTreeSectionSubpathExpansion (QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey, const QString &key, bool expanded)
 Add / remove one descendant subpath key under rootKey in map. Mirrors luaDbgRecordTreeSectionRootExpansion: removing the last subpath of a collapsed root erases the root entry too.
 
QStringList luaDbgTreeSectionExpandedSubpaths (const QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey)
 Expanded-descendant subpaths recorded for rootKey, or empty.
 
QString luaDebuggerSettingsFilePath ()
 Returns the file path for Lua debugger settings.
 
QKeySequence luaDbgSeqFromKeyEvent (const QKeyEvent *ke)
 Build a key sequence from a key event for matching against QAction shortcuts. Wraps the Qt5/Qt6 modifier-encoding split so callers do not have to repeat the version check.
 
QString LuaDebuggerItems::rowColumnDisplayText (const QModelIndex &indexInRow, int col)
 Qt::DisplayRole text for column col in the same row as indexInRow.
 
QStandardItem * LuaDebuggerItems::rowCol0 (QStandardItemModel *model, QStandardItem *cell)
 Column-0 item for the same row as cell.
 
QStandardItem * LuaDebuggerItems::cellAt (QStandardItemModel *model, QStandardItem *col0, int col)
 Cell in column col for a row whose column-0 anchor is col0.
 
QString LuaDebuggerItems::text (QStandardItemModel *model, QStandardItem *col0, int col)
 Return the text for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setText (QStandardItemModel *model, QStandardItem *col0, int col, const QString &t)
 Set the text for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setToolTip (QStandardItemModel *model, QStandardItem *col0, int col, const QString &tip)
 Set the tool tip for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setFont (QStandardItemModel *model, QStandardItem *col0, int col, const QFont &font)
 Set the font for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setForeground (QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
 Set the foreground brush for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setBackground (QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
 Set the background brush for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setIcon (QStandardItemModel *model, QStandardItem *col0, int col, const QIcon &icon)
 Set the icon for a cell in column col for a row whose column-0 anchor is col0.
 
void LuaDebuggerItems::setTextAlignment (QStandardItemModel *model, QStandardItem *col0, int col, Qt::Alignment align)
 Set the text alignment for a cell in column col for a row whose column-0 anchor is col0.
 
QModelIndex LuaDebuggerItems::indexCol0 (QStandardItemModel *model, QStandardItem *col0)
 Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree view.
 
bool LuaDebuggerItems::isExpanded (QTreeView *tree, QStandardItemModel *model, QStandardItem *col0)
 Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree view.
 
void LuaDebuggerItems::setExpanded (QTreeView *tree, QStandardItemModel *model, QStandardItem *col0, bool expanded)
 Set the expansion state for a cell in column col for a row whose column-0 anchor is col0.
 
LuaDbgInvalidFilterColors LuaDebuggerPath::invalidFilterColors ()
 Return the foreground and background colors used to indicate an invalid filter expression in the Lua debugger.
 
bool LuaDebuggerPath::watchSpecIsGlobalScoped (const QString &spec)
 Check whether a watch specification is globally scoped.
 
bool LuaDebuggerPath::variablesPathIsGlobalScoped (const QString &path)
 Check whether a variables path is globally scoped.
 
QString LuaDebuggerPath::changeKey (int stackLevel, const QString &path)
 Return the change key for a variable at a given stack level and path.
 
QString LuaDebuggerPath::watchSpecFromChangeKey (const QString &key)
 Return the watch specification corresponding to a change key.
 
QString LuaDebuggerPath::stripWatchExpressionErrorPrefix (const QString &errStr)
 Strip the error prefix from a watch expression error string.
 
template<class Key , class Map >
bool LuaDebuggerPath::shouldMarkChanged (const Map &baseline, const Key &key, const QString &newVal, bool flashNew=false)
 Determine whether a variable has changed based on its current and baseline values.
 
QString LuaDebuggerPath::variableSectionRootKeyFromItem (const QStandardItem *item)
 Return the root key of the variable section containing an item.
 
bool LuaDebuggerPath::watchSpecUsesPathResolution (const QString &spec)
 Check whether a watch specification uses path resolution.
 
QString LuaDebuggerPath::variableTreeChildPath (const QString &parentPath, const QString &nameText)
 Return the path of a child node in the variable tree.
 
QString LuaDebuggerPath::expressionWatchChildSubpath (const QString &parentSubpath, const QString &nameText)
 Return the subpath of a child node in an expression watch tree.
 
bool LuaDebuggerPath::variableChildrenShouldSortByName (const QString &parentPath)
 Check whether children of a variable node should be sorted by name.
 
VariableRowFields LuaDebuggerPath::readVariableRowFields (const wslua_variable_t &v, const QString &parentPath)
 Read the display fields of a variable row from a Lua variable.
 
void LuaDebuggerPath::applyVariableExpansionIndicator (QStandardItem *anchor, bool canExpand, bool enabledOnlyPlaceholder, int columnCount=3)
 Apply an expansion indicator to a variable row anchor item.
 
QString LuaDebuggerPath::watchVariablePathForSpec (const QString &spec)
 Return the variable path for a watch specification.
 
QString LuaDebuggerPath::watchResolvedVariablePathForTooltip (const QString &spec)
 Return the resolved variable path for a watch tooltip.
 
void LuaDebuggerPath::watchRootSetVariablePathRoleFromSpec (QStandardItem *row, const QString &spec)
 Set the variable path role on a watch root row item from a watch specification.
 
QString LuaDebuggerPath::watchPathOriginSuffix (const QStandardItem *item, const QString &spec)
 Return the origin suffix for a watch path tooltip.
 
QString LuaDebuggerPath::capWatchTooltipText (const QString &s)
 Truncate a watch tooltip text string to a reasonable length.
 
QString LuaDebuggerPath::watchPathParentKey (const QString &path)
 Return the parent key of a watch path.
 
void LuaDebuggerPath::applyWatchChildRowTextAndTooltip (QStandardItem *specItem, const QString &rawVal, const QString &typeText)
 Apply the raw value and type text to a watch child row item.
 
int LuaDebuggerPath::watchSubpathBoundaryCount (const QString &subpath)
 Return the number of subpath boundaries in a watch subpath.
 
QStandardItem * LuaDebuggerPath::findWatchItemBySubpathOrPathKey (QStandardItem *subtree, const QString &key)
 Find a watch item in a subtree by its subpath or path key.
 
QStandardItem * LuaDebuggerPath::findVariableTreeItemByPathKey (QStandardItem *subtree, const QString &key)
 Find a variable tree item in a subtree by its path key.
 
void LuaDebuggerPath::reexpandTreeDescendantsByPathKeys (QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree, QStringList pathKeys, TreePathKeyFinder findByKey)
 Re-expand previously expanded descendants of a subtree by their path keys.
 
void LuaDebuggerPath::reexpandWatchDescendantsByPathKeys (QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree, QStringList pathKeys)
 Re-expand previously expanded watch descendants of a subtree by their path keys.
 
void LuaDebuggerPath::clearWatchFilterErrorChrome (QStandardItem *specItem, QTreeView *tree)
 Clear the filter error chrome from a watch specification item.
 
void LuaDebuggerPath::applyWatchFilterErrorChrome (QStandardItem *specItem, QTreeView *tree)
 Apply filter error chrome to a watch specification item.
 
void LuaDebuggerPath::setupWatchRootItemFromSpec (QStandardItem *specItem, QStandardItem *valueItem, const QString &spec)
 Set up a watch root item from a watch specification.
 
QStandardItem * LuaDebuggerPath::findVariableItemByPathRecursive (QStandardItem *node, const QString &path)
 Find a variable item by path in a subtree, searching recursively.
 
QString LuaDebuggerPath::watchItemExpansionKey (const QStandardItem *item)
 Return the expansion key for a watch item.
 
QIcon luaDbgMakeSelectionAwareIcon (const QIcon &base, const QPalette &palette)
 Create a selection-aware icon for tree icons (breakpoints, variables, and watch) that applies a selected-row tint.
 
QIcon luaDbgPaintedGlyphIcon (const QString &glyph, int side, qreal dpr, const QFont &baseFont, const QColor &color, int margin=1)
 Paint a glyph centred into a square pixmap and return it as an icon.
 
QIcon luaDbgPaintedGlyphButtonIcon (const QString &glyph, int side, qreal dpr, const QFont &baseFont, const QPalette &palette, int margin=2)
 Creates an icon for a painted glyph button.
 
void luaDbgDrawBreakpointDot (QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled, bool hasExtras=false, int alpha=255)
 Draws a breakpoint dot on the given painter.
 
QIcon luaDbgBreakpointHeaderIconForMode (const QFont *editorFont, LuaDbgBpHeaderIconMode mode, int headerSide, qreal dpr)
 Return the appropriate breakpoint header icon for the given mode.
 
void styleLuaDebuggerHeaderBreakpointToggleButton (QToolButton *btn, int side)
 Style a Lua debugger header breakpoint toggle button.
 
void styleLuaDebuggerHeaderFittedTextButton (QToolButton *btn, int side, const QFont &titleFont, const QStringList &glyphs)
 Style a Lua debugger header button with fitted text glyphs.
 
void styleLuaDebuggerHeaderPlusMinusButton (QToolButton *btn, int side, const QFont &titleFont)
 Style a Lua debugger header plus/minus button.
 
void styleLuaDebuggerHeaderIconOnlyButton (QToolButton *btn, int side)
 Style a Lua debugger header icon-only button.
 
QIcon luaDbgErrorBreakHeaderIcon (bool checked, int side, qreal dpr, const QFont &titleFont, const QPalette &palette)
 Build a colored Break-on-Error toggle icon for the breakpoints section header.
 

Variables

constexpr const char * LuaDebuggerSettingsKeys::Theme = "theme"
 
constexpr const char * LuaDebuggerSettingsKeys::DebuggerEnabled = "debuggerEnabled"
 
constexpr const char * LuaDebuggerSettingsKeys::MainSplitter = "mainSplitterState"
 
constexpr const char * LuaDebuggerSettingsKeys::LeftSplitter = "leftSplitterState"
 
constexpr const char * LuaDebuggerSettingsKeys::EvalSplitter = "evalSplitterState"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionVariables = "sectionVariables"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionStack = "sectionStack"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionFiles = "sectionFiles"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionBreakpoints = "sectionBreakpoints"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionEval = "sectionEval"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionSettings = "sectionSettings"
 
constexpr const char * LuaDebuggerSettingsKeys::SectionWatch = "sectionWatch"
 
constexpr const char * LuaDebuggerSettingsKeys::Breakpoints = "breakpoints"
 
constexpr const char * LuaDebuggerSettingsKeys::Watches = "watches"
 
constexpr const char * LuaDebuggerSettingsKeys::BreakOnError = "breakOnError"
 
constexpr qint32 FileTreePathRole = static_cast<qint32>(Qt::UserRole)
 
constexpr qint32 FileTreeIsDirectoryRole = static_cast<qint32>(Qt::UserRole + 1)
 
constexpr qint32 BreakpointFileRole = static_cast<qint32>(Qt::UserRole + 2)
 
constexpr qint32 BreakpointLineRole = static_cast<qint32>(Qt::UserRole + 3)
 
constexpr qint32 BreakpointConditionRole = static_cast<qint32>(Qt::UserRole + 30)
 
constexpr qint32 BreakpointHitCountRole = static_cast<qint32>(Qt::UserRole + 31)
 
constexpr qint32 BreakpointHitTargetRole = static_cast<qint32>(Qt::UserRole + 32)
 
constexpr qint32 BreakpointConditionErrRole = static_cast<qint32>(Qt::UserRole + 33)
 
constexpr qint32 BreakpointLogMessageRole = static_cast<qint32>(Qt::UserRole + 34)
 
constexpr qint32 BreakpointHitModeRole = static_cast<qint32>(Qt::UserRole + 35)
 
constexpr qint32 BreakpointLogAlsoPauseRole = static_cast<qint32>(Qt::UserRole + 36)
 
constexpr qint32 StackItemFileRole = static_cast<qint32>(Qt::UserRole + 4)
 
constexpr qint32 StackItemLineRole = static_cast<qint32>(Qt::UserRole + 5)
 
constexpr qint32 StackItemNavigableRole = static_cast<qint32>(Qt::UserRole + 6)
 
constexpr qint32 StackItemLevelRole = static_cast<qint32>(Qt::UserRole + 7)
 
constexpr qint32 VariablePathRole = static_cast<qint32>(Qt::UserRole + 8)
 
constexpr qint32 VariableTypeRole = static_cast<qint32>(Qt::UserRole + 9)
 
constexpr qint32 VariableCanExpandRole = static_cast<qint32>(Qt::UserRole + 10)
 
constexpr qint32 WatchSpecRole = static_cast<qint32>(Qt::UserRole + 11)
 
constexpr qint32 WatchSubpathRole = static_cast<qint32>(Qt::UserRole + 13)
 
constexpr qint32 WatchPendingNewRole = static_cast<qint32>(Qt::UserRole + 15)
 
constexpr qint32 ChangedFlashSerialRole = static_cast<qint32>(Qt::UserRole + 20)
 
constexpr qsizetype WATCH_TOOLTIP_MAX_CHARS = 4096
 
constexpr int WATCH_EXPR_MAX_CHARS = 65536
 
constexpr int CHANGED_FLASH_MS = 500
 
constexpr int WATCH_PLACEHOLDER_DEFER_MS = 250
 
constexpr QChar CHANGE_KEY_SEP = QChar(0x1F)
 
constexpr int kLuaDbgEvalOutputMaxLines = 5000
 
const QKeySequence kLuaDbgCtxGoToLine
 
const QKeySequence kLuaDbgCtxRunToLine
 
const QKeySequence kLuaDbgCtxWatchEdit
 
const QKeySequence kLuaDbgCtxWatchCopyValue
 
const QKeySequence kLuaDbgCtxWatchDuplicate
 
const QKeySequence kLuaDbgCtxWatchRemoveAll
 
const QKeySequence kLuaDbgCtxAddWatch
 
const QKeySequence kLuaDbgCtxToggleBreakpoint
 
const QKeySequence kLuaDbgCtxReloadLuaPlugins
 
const QKeySequence kLuaDbgCtxRemoveAllBreakpoints
 
const QString kLuaDbgHeaderPlus
 
const QString kLuaDbgHeaderMinus
 
const QString kLuaDbgHeaderEdit
 
const QString kLuaDbgRowLog
 
const QString kLuaDbgRowExtras
 
const QString kLuaDbgHeaderRemoveAll
 
const QString kLuaDbgHeaderToolButtonStyle
 

Detailed Description

Shared helpers used across the debugger panels.

Enumeration Type Documentation

◆ LuaDbgBpHeaderIconMode

enum class LuaDbgBpHeaderIconMode
strong

Controls the state of the header toggle icon in the Lua debugger breakpoint list.

Enumerator
NoBreakpoints 

No breakpoints are defined; header icon reflects an empty list

ActivateAll 

At least one breakpoint is inactive; header icon offers to activate all

DeactivateAll 

All breakpoints are active; header icon offers to deactivate all

Function Documentation

◆ applyVariableExpansionIndicator()

void LuaDebuggerPath::applyVariableExpansionIndicator ( QStandardItem *  anchor,
bool  canExpand,
bool  enabledOnlyPlaceholder,
int  columnCount = 3 
)

Apply an expansion indicator to a variable row anchor item.

Parameters
anchorThe anchor item in the variable tree.
canExpandWhether the item can be expanded.
enabledOnlyPlaceholderWhether to use an enabled-only placeholder.
columnCountThe number of columns in the tree (default 3).

◆ applyWatchChildRowTextAndTooltip()

void LuaDebuggerPath::applyWatchChildRowTextAndTooltip ( QStandardItem *  specItem,
const QString &  rawVal,
const QString &  typeText 
)

Apply the raw value and type text to a watch child row item.

Parameters
specItemThe watch specification item.
rawValThe raw value string.
typeTextThe type text string.

◆ applyWatchFilterErrorChrome()

void LuaDebuggerPath::applyWatchFilterErrorChrome ( QStandardItem *  specItem,
QTreeView *  tree 
)

Apply filter error chrome to a watch specification item.

Parameters
specItemThe watch specification item.
treeThe tree view.

◆ capWatchTooltipText()

QString LuaDebuggerPath::capWatchTooltipText ( const QString &  s)

Truncate a watch tooltip text string to a reasonable length.

Parameters
sThe tooltip text string.
Returns
The capped tooltip text string.

◆ cellAt()

QStandardItem * LuaDebuggerItems::cellAt ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col 
)
inline

Cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to query.
Returns
The cell for the specified column.

◆ changeKey()

QString LuaDebuggerPath::changeKey ( int  stackLevel,
const QString &  path 
)

Return the change key for a variable at a given stack level and path.

Parameters
stackLevelThe stack level of the variable.
pathThe path of the variable.
Returns
The change key string.

◆ clearWatchFilterErrorChrome()

void LuaDebuggerPath::clearWatchFilterErrorChrome ( QStandardItem *  specItem,
QTreeView *  tree 
)

Clear the filter error chrome from a watch specification item.

Parameters
specItemThe watch specification item.
treeThe tree view.

◆ expressionWatchChildSubpath()

QString LuaDebuggerPath::expressionWatchChildSubpath ( const QString &  parentSubpath,
const QString &  nameText 
)

Return the subpath of a child node in an expression watch tree.

Parameters
parentSubpathThe subpath of the parent node.
nameTextThe name of the child node.
Returns
The subpath of the child node.

◆ findVariableItemByPathRecursive()

QStandardItem * LuaDebuggerPath::findVariableItemByPathRecursive ( QStandardItem *  node,
const QString &  path 
)

Find a variable item by path in a subtree, searching recursively.

Parameters
nodeThe root item of the subtree to search.
pathThe path to search for.
Returns
The matching item, or nullptr if not found.

◆ findVariableTreeItemByPathKey()

QStandardItem * LuaDebuggerPath::findVariableTreeItemByPathKey ( QStandardItem *  subtree,
const QString &  key 
)

Find a variable tree item in a subtree by its path key.

Parameters
subtreeThe root item of the subtree to search.
keyThe path key to search for.
Returns
The matching item, or nullptr if not found.

◆ findWatchItemBySubpathOrPathKey()

QStandardItem * LuaDebuggerPath::findWatchItemBySubpathOrPathKey ( QStandardItem *  subtree,
const QString &  key 
)

Find a watch item in a subtree by its subpath or path key.

Parameters
subtreeThe root item of the subtree to search.
keyThe subpath or path key to search for.
Returns
The matching item, or nullptr if not found.

◆ indexCol0()

QModelIndex LuaDebuggerItems::indexCol0 ( QStandardItemModel *  model,
QStandardItem *  col0 
)
inline

Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree view.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
Returns
The QModelIndex for col0, or an invalid index on failure.

◆ invalidFilterColors()

LuaDbgInvalidFilterColors LuaDebuggerPath::invalidFilterColors ( )

Return the foreground and background colors used to indicate an invalid filter expression in the Lua debugger.

Background is read from ThemeManager::FilterInvalid; foreground is derived locally via ColorMath::contrastingText against that background (WCAG luminance pick — black on light tints, white on dark).

Returns
A struct containing the foreground and background colors.

◆ isExpanded()

bool LuaDebuggerItems::isExpanded ( QTreeView *  tree,
QStandardItemModel *  model,
QStandardItem *  col0 
)
inline

Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree view.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
Returns
true if the specified cell is expanded, false otherwise.

◆ luaDbgBreakpointHeaderIconForMode()

QIcon luaDbgBreakpointHeaderIconForMode ( const QFont *  editorFont,
LuaDbgBpHeaderIconMode  mode,
int  headerSide,
qreal  dpr 
)

Return the appropriate breakpoint header icon for the given mode.

Parameters
editorFontThe font used in the editor.
modeThe breakpoint header icon mode.
headerSideThe side length of the header icon in pixels.
dprThe device pixel ratio for HiDPI scaling.
Returns
A QIcon for the breakpoint header in the given mode.

◆ luaDbgDrawBreakpointDot()

void luaDbgDrawBreakpointDot ( QPainter &  painter,
qreal  dotLeft,
qreal  dotTop,
qreal  radius,
bool  enabled,
bool  hasExtras = false,
int  alpha = 255 
)

Draws a breakpoint dot on the given painter.

Parameters
painterThe QPainter object to draw on.
dotLeftThe left coordinate of the dot.
dotTopThe top coordinate of the dot.
radiusThe radius of the dot.
enabledWhether the breakpoint is enabled.
hasExtrasWhether the dot has additional extras.
alphaThe transparency level of the dot.

◆ luaDbgErrorBreakHeaderIcon()

QIcon luaDbgErrorBreakHeaderIcon ( bool  checked,
int  side,
qreal  dpr,
const QFont &  titleFont,
const QPalette &  palette 
)

Build a colored Break-on-Error toggle icon for the breakpoints section header.

Paints a warning-sign glyph, red (#DC3545) when checked (active), gray (disabled text color) when unchecked.

Parameters
checkedtrue to paint yellow, false to paint gray
sideicon size in pixels
dprdevice pixel ratio
titleFontfont to use for glyph rendering
palettepalette for disabled text color
Returns
colored warning-sign icon

◆ luaDbgMakeSelectionAwareIcon()

QIcon luaDbgMakeSelectionAwareIcon ( const QIcon &  base,
const QPalette &  palette 
)

Create a selection-aware icon for tree icons (breakpoints, variables, and watch) that applies a selected-row tint.

Parameters
baseThe base icon to tint.
paletteThe palette to derive the selection tint from.
Returns
A QIcon that applies a tint when the row is selected.

◆ luaDbgPaintedGlyphButtonIcon()

QIcon luaDbgPaintedGlyphButtonIcon ( const QString &  glyph,
int  side,
qreal  dpr,
const QFont &  baseFont,
const QPalette &  palette,
int  margin = 2 
)

Creates an icon for a painted glyph button.

Returns a header-button-flavoured QIcon with two pixmaps painted from glyph: a Normal pixmap in palette.color(Active, ButtonText) and a Disabled pixmap in palette.color(Disabled, ButtonText). The Disabled pixmap is added so QToolButton renders it directly when the button is disabled instead of falling back to QStyle::generatedIcon- Pixmap()'s synthesised filter (which on Linux produces a darker tone than the palette's disabled-text gray used by neighbouring text-only buttons).

Parameters
glyphThe glyph to be displayed on the button.
sideThe size of the icon in pixels.
dprThe device pixel ratio.
baseFontThe base font for rendering the glyph.
paletteThe color palette to use for rendering the glyph.
marginThe margin around the glyph.
Returns
QIcon The created icon with both active and disabled states.

◆ luaDbgPaintedGlyphIcon()

QIcon luaDbgPaintedGlyphIcon ( const QString &  glyph,
int  side,
qreal  dpr,
const QFont &  baseFont,
const QColor &  color,
int  margin = 1 
)

Paint a glyph centred into a square pixmap and return it as an icon.

Paints glyph centred into a square side x side pixmap (scaled by dpr for HiDPI), sized so the glyph's inked extent fills the cell.

Parameters
glyphThe glyph string to paint.
sideThe side length of the square pixmap in pixels.
dprThe device pixel ratio for HiDPI scaling.
baseFontThe font to use for painting the glyph.
colorThe color to paint the glyph with.
marginThe margin around the glyph in pixels (default 1).
Returns
A QIcon containing the painted glyph.

◆ luaDbgRecordTreeSectionRootExpansion()

void luaDbgRecordTreeSectionRootExpansion ( QHash< QString, LuaDbgTreeSectionExpansionState > &  map,
const QString &  rootKey,
bool  expanded 
)

Record / clear root-level expansion for rootKey in map. Mutates map in place; collapsing a root with no remembered subpaths drops the entry entirely so the map stays minimal.

Parameters
mapReference to the hash map that stores the expansion state of tree sections.
rootKeyThe key representing the root section whose expansion state is to be recorded or cleared.
expandedBoolean indicating whether the root section should be expanded (true) or collapsed (false).

◆ luaDbgRecordTreeSectionSubpathExpansion()

void luaDbgRecordTreeSectionSubpathExpansion ( QHash< QString, LuaDbgTreeSectionExpansionState > &  map,
const QString &  rootKey,
const QString &  key,
bool  expanded 
)

Add / remove one descendant subpath key under rootKey in map. Mirrors luaDbgRecordTreeSectionRootExpansion: removing the last subpath of a collapsed root erases the root entry too.

Parameters
mapReference to the hash map that stores the expansion state of tree sections.
rootKeyThe root key under which the subpath is being expanded or collapsed.
keyThe subpath key to be added or removed.
expandedBoolean indicating whether the subpath is being expanded (true) or collapsed (false).

◆ luaDbgSeqFromKeyEvent()

QKeySequence luaDbgSeqFromKeyEvent ( const QKeyEvent *  ke)

Build a key sequence from a key event for matching against QAction shortcuts. Wraps the Qt5/Qt6 modifier-encoding split so callers do not have to repeat the version check.

Parameters
kePointer to the QKeyEvent object containing the key event information.
Returns
QKeySequence The constructed key sequence based on the key event.

◆ luaDbgTreeSectionExpandedSubpaths()

QStringList luaDbgTreeSectionExpandedSubpaths ( const QHash< QString, LuaDbgTreeSectionExpansionState > &  map,
const QString &  rootKey 
)

Expanded-descendant subpaths recorded for rootKey, or empty.

Parameters
mapHash containing expansion states for LuaDbgTreeSection objects.
rootKeyKey of the root section to retrieve expanded subpaths for.
Returns
QStringList List of expanded subpaths under the specified rootKey.

◆ luaDbgWatchRootItem()

QStandardItem * luaDbgWatchRootItem ( QStandardItem *  item)
inline

Finds the root item of a QStandardItem hierarchy.

Walk watch-tree items to the top-level row (same row family as WatchSpecRole root).

Parameters
itemThe starting item in the hierarchy.
Returns
The root item of the hierarchy.

◆ luaDebuggerSettingsFilePath()

QString luaDebuggerSettingsFilePath ( )

Returns the file path for Lua debugger settings.

Global personal config path — debugger settings are not profile-specific.

Returns
QString The file path for Lua debugger settings.

◆ readVariableRowFields()

VariableRowFields LuaDebuggerPath::readVariableRowFields ( const wslua_variable_t v,
const QString &  parentPath 
)

Read the display fields of a variable row from a Lua variable.

Parameters
vThe Lua variable to read from.
parentPathThe path of the parent variable node.
Returns
A VariableRowFields struct containing the display fields.

◆ reexpandTreeDescendantsByPathKeys()

void LuaDebuggerPath::reexpandTreeDescendantsByPathKeys ( QTreeView *  tree,
QStandardItemModel *  model,
QStandardItem *  subtree,
QStringList  pathKeys,
TreePathKeyFinder  findByKey 
)

Re-expand previously expanded descendants of a subtree by their path keys.

Parameters
treeThe tree view.
modelThe tree model.
subtreeThe root item of the subtree to re-expand.
pathKeysThe list of path keys to re-expand.
findByKeyThe function to find an item by path key.

◆ reexpandWatchDescendantsByPathKeys()

void LuaDebuggerPath::reexpandWatchDescendantsByPathKeys ( QTreeView *  tree,
QStandardItemModel *  model,
QStandardItem *  subtree,
QStringList  pathKeys 
)

Re-expand previously expanded watch descendants of a subtree by their path keys.

Parameters
treeThe tree view.
modelThe tree model.
subtreeThe root item of the subtree to re-expand.
pathKeysThe list of path keys to re-expand.

◆ rowCol0()

QStandardItem * LuaDebuggerItems::rowCol0 ( QStandardItemModel *  model,
QStandardItem *  cell 
)
inline

Column-0 item for the same row as cell.

Parameters
modelThe standard item model.
cellThe cell for which to find the column-0 item.
Returns
The column-0 item for the same row as cell.

◆ rowColumnDisplayText()

QString LuaDebuggerItems::rowColumnDisplayText ( const QModelIndex &  indexInRow,
int  col 
)
inline

Qt::DisplayRole text for column col in the same row as indexInRow.

Parameters
indexInRowThe index of the row to query.
colThe column to query.
Returns
The display text for the specified cell.

◆ setBackground()

void LuaDebuggerItems::setBackground ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QBrush &  brush 
)
inline

Set the background brush for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
brushThe background brush to set for the specified cell.

◆ setExpanded()

void LuaDebuggerItems::setExpanded ( QTreeView *  tree,
QStandardItemModel *  model,
QStandardItem *  col0,
bool  expanded 
)
inline

Set the expansion state for a cell in column col for a row whose column-0 anchor is col0.

Parameters
treeThe tree view to set expansion state.
modelThe standard item model.
col0The column-0 item for the row.
expandedThe expansion state to set for the specified cell.

◆ setFont()

void LuaDebuggerItems::setFont ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QFont &  font 
)
inline

Set the font for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
fontThe font to set for the specified cell.

◆ setForeground()

void LuaDebuggerItems::setForeground ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QBrush &  brush 
)
inline

Set the foreground brush for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
brushThe foreground brush to set for the specified cell.

◆ setIcon()

void LuaDebuggerItems::setIcon ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QIcon &  icon 
)
inline

Set the icon for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
iconThe icon to set for the specified cell.

◆ setText()

void LuaDebuggerItems::setText ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QString &  t 
)
inline

Set the text for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
tThe text to set for the specified cell.

◆ setTextAlignment()

void LuaDebuggerItems::setTextAlignment ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
Qt::Alignment  align 
)
inline

Set the text alignment for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
alignThe text alignment to set for the specified cell.

◆ setToolTip()

void LuaDebuggerItems::setToolTip ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col,
const QString &  tip 
)
inline

Set the tool tip for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to set.
tipThe tool tip to set for the specified cell.

◆ setupWatchRootItemFromSpec()

void LuaDebuggerPath::setupWatchRootItemFromSpec ( QStandardItem *  specItem,
QStandardItem *  valueItem,
const QString &  spec 
)

Set up a watch root item from a watch specification.

Parameters
specItemThe watch specification item.
valueItemThe watch value item.
specThe watch specification string.

◆ shouldMarkChanged()

template<class Key , class Map >
bool LuaDebuggerPath::shouldMarkChanged ( const Map &  baseline,
const Key &  key,
const QString &  newVal,
bool  flashNew = false 
)

Determine whether a variable has changed based on its current and baseline values.

Parameters
baselineThe baseline map of variable values.
keyThe key for the variable to check.
newValThe new value for the variable.
flashNewWhether to flash the new value.
Returns
true if the variable has changed, false otherwise.

◆ stripWatchExpressionErrorPrefix()

QString LuaDebuggerPath::stripWatchExpressionErrorPrefix ( const QString &  errStr)

Strip the error prefix from a watch expression error string.

Parameters
errStrThe error string to strip.
Returns
The error string with the watch expression error prefix removed.

◆ styleLuaDebuggerHeaderBreakpointToggleButton()

void styleLuaDebuggerHeaderBreakpointToggleButton ( QToolButton *  btn,
int  side 
)

Style a Lua debugger header breakpoint toggle button.

Parameters
btnThe tool button to style.
sideThe side length of the button in pixels.

◆ styleLuaDebuggerHeaderFittedTextButton()

void styleLuaDebuggerHeaderFittedTextButton ( QToolButton *  btn,
int  side,
const QFont &  titleFont,
const QStringList &  glyphs 
)

Style a Lua debugger header button with fitted text glyphs.

Parameters
btnThe tool button to style.
sideThe side length of the button in pixels.
titleFontThe font used for sizing the glyphs.
glyphsThe list of glyph strings to fit within the button.

◆ styleLuaDebuggerHeaderIconOnlyButton()

void styleLuaDebuggerHeaderIconOnlyButton ( QToolButton *  btn,
int  side 
)

Style a Lua debugger header icon-only button.

Parameters
btnThe tool button to style.
sideThe side length of the button in pixels.

◆ styleLuaDebuggerHeaderPlusMinusButton()

void styleLuaDebuggerHeaderPlusMinusButton ( QToolButton *  btn,
int  side,
const QFont &  titleFont 
)

Style a Lua debugger header plus/minus button.

Parameters
btnThe tool button to style.
sideThe side length of the button in pixels.
titleFontThe font used for sizing the plus/minus glyph.

◆ text()

QString LuaDebuggerItems::text ( QStandardItemModel *  model,
QStandardItem *  col0,
int  col 
)
inline

Return the text for a cell in column col for a row whose column-0 anchor is col0.

Parameters
modelThe standard item model.
col0The column-0 item for the row.
colThe column to query.
Returns
The text for the specified cell.

◆ variableChildrenShouldSortByName()

bool LuaDebuggerPath::variableChildrenShouldSortByName ( const QString &  parentPath)

Check whether children of a variable node should be sorted by name.

Parameters
parentPathThe path of the parent variable node.
Returns
true if children should be sorted by name, false otherwise.

◆ variableSectionRootKeyFromItem()

QString LuaDebuggerPath::variableSectionRootKeyFromItem ( const QStandardItem *  item)

Return the root key of the variable section containing an item.

Parameters
itemThe item in the variable tree.
Returns
The root key string of the variable section.

◆ variablesPathIsGlobalScoped()

bool LuaDebuggerPath::variablesPathIsGlobalScoped ( const QString &  path)

Check whether a variables path is globally scoped.

Parameters
pathThe variables path string.
Returns
true if the path is globally scoped, false otherwise.

◆ variableTreeChildPath()

QString LuaDebuggerPath::variableTreeChildPath ( const QString &  parentPath,
const QString &  nameText 
)

Return the path of a child node in the variable tree.

Parameters
parentPathThe path of the parent node.
nameTextThe name of the child node.
Returns
The path of the child node.

◆ watchItemExpansionKey()

QString LuaDebuggerPath::watchItemExpansionKey ( const QStandardItem *  item)

Return the expansion key for a watch item.

Parameters
itemThe watch item.
Returns
The expansion key string used to restore expansion state.

◆ watchPathOriginSuffix()

QString LuaDebuggerPath::watchPathOriginSuffix ( const QStandardItem *  item,
const QString &  spec 
)

Return the origin suffix for a watch path tooltip.

Parameters
itemThe item in the watch tree.
specThe watch specification string.
Returns
The origin suffix string.

◆ watchPathParentKey()

QString LuaDebuggerPath::watchPathParentKey ( const QString &  path)

Return the parent key of a watch path.

Parameters
pathThe watch path string.
Returns
The parent key string.

◆ watchResolvedVariablePathForTooltip()

QString LuaDebuggerPath::watchResolvedVariablePathForTooltip ( const QString &  spec)

Return the resolved variable path for a watch tooltip.

Parameters
specThe watch specification string.
Returns
The resolved variable path string for display in a tooltip.

◆ watchRootSetVariablePathRoleFromSpec()

void LuaDebuggerPath::watchRootSetVariablePathRoleFromSpec ( QStandardItem *  row,
const QString &  spec 
)

Set the variable path role on a watch root row item from a watch specification.

Parameters
rowThe root row item.
specThe watch specification string.

◆ watchSpecFromChangeKey()

QString LuaDebuggerPath::watchSpecFromChangeKey ( const QString &  key)

Return the watch specification corresponding to a change key.

Parameters
keyThe change key string.
Returns
The watch specification string.

◆ watchSpecIsGlobalScoped()

bool LuaDebuggerPath::watchSpecIsGlobalScoped ( const QString &  spec)

Check whether a watch specification is globally scoped.

Parameters
specThe watch specification string.
Returns
true if the specification is globally scoped, false otherwise.

◆ watchSpecUsesPathResolution()

bool LuaDebuggerPath::watchSpecUsesPathResolution ( const QString &  spec)

Check whether a watch specification uses path resolution.

Parameters
specThe watch specification string.
Returns
true if the specification uses path resolution, false otherwise.

◆ watchSubpathBoundaryCount()

int LuaDebuggerPath::watchSubpathBoundaryCount ( const QString &  subpath)

Return the number of subpath boundaries in a watch subpath.

Parameters
subpathThe watch subpath string.
Returns
The number of subpath boundaries.

◆ watchVariablePathForSpec()

QString LuaDebuggerPath::watchVariablePathForSpec ( const QString &  spec)

Return the variable path for a watch specification.

Parameters
specThe watch specification string.
Returns
The variable path string.

Variable Documentation

◆ DebuggerEnabled

constexpr const char* LuaDebuggerSettingsKeys::DebuggerEnabled = "debuggerEnabled"
constexpr

Last toolbar "Enable debugger" checkbox state (persisted across dialog instances).

◆ kLuaDbgEvalOutputMaxLines

constexpr int kLuaDbgEvalOutputMaxLines = 5000
constexpr

Maximum number of lines the Evaluate / logpoint output retains.

◆ kLuaDbgHeaderEdit

const QString kLuaDbgHeaderEdit
extern

Gear (U+2699 + U+FE0E text presentation) for the Edit Breakpoint header button.

◆ kLuaDbgHeaderPlus

const QString kLuaDbgHeaderPlus
extern

Fullwidth +/- and flat tool button style for section headers.

◆ kLuaDbgHeaderRemoveAll

const QString kLuaDbgHeaderRemoveAll
extern

Circled Latin capital letter X (U+24CD) for the Remove All header buttons (Watch and Breakpoints).

◆ kLuaDbgRowExtras

const QString kLuaDbgRowExtras
extern

Reference mark (U+203B) for the Active-column condition / hit-count row indicator.

◆ kLuaDbgRowLog

const QString kLuaDbgRowLog
extern

Three stacked horizontal lines (U+2630 trigram for heaven) for the Active-column logpoint row indicator.