Editable code editor supporting gutter breakpoints and highlighting.
More...
#include <lua_debugger_code_editor.h>
|
| void | breakpointToggled (const QString &filename, qint32 line, bool toggleActive) |
| | Emitted when a breakpoint icon is clicked within the gutter (right margin).
|
| |
|
void | breakpointMoveRequested (const QString &filename, qint32 fromLine, qint32 toLine) |
| | Request moving a breakpoint in filename from fromLine to toLine after a gutter drag-and-drop gesture.
|
| |
| void | breakpointGutterMenuRequested (const QString &filename, qint32 line, const QPoint &globalPos) |
| | Request an Edit / Disable (Enable) / Remove popup for the breakpoint at filename:line, anchored at globalPos.
|
| |
|
| | LuaDebuggerCodeView (QWidget *parent=nullptr) |
| | Create the code view and configure the line number gutter.
|
| |
| void | lineNumberAreaPaintEvent (QPaintEvent *event) |
| | Paint the custom gutter that hosts line numbers and breakpoints.
|
| |
| qint32 | lineNumberAreaWidth () |
| | Compute the width required for the gutter, including icons.
|
| |
| void | setFilename (const QString &f) |
| | Set the file path this editor is currently hosting, for use in breakpoint management and the "edited" tab marker. The path is opaque to the editor and can be set to an empty string for unsaved buffers or those not hosting files on disk.
|
| |
| QString | getFilename () const |
| | Get the file path associated with this editor.
|
| |
|
void | setCurrentLine (qint32 line) |
| | Set the debugger "execution paused" line (amber bar) and move the caret to that line. Pass <= 0 to clear only the paused-line bar.
|
| |
|
void | clearCurrentLineHighlight () |
| | Clear the debugger paused-line highlight (caret stripe unchanged).
|
| |
|
void | moveCaretToLineStart (qint32 line) |
| | Move the caret to the start of a line without changing the paused line (e.g. go-to-line).
|
| |
| void | setEditorFont (const QFont &font) |
| | Apply a monospace font to both editor text and gutter.
|
| |
|
void | updateBreakpointMarkers () |
| | Refresh breakpoint markers in the gutter area.
|
| |
|
void | applyTheme () |
| | Re-apply theme colors from the current preference.
|
| |
| QString | luaIdentifierUnderCursor (const QTextCursor &cursor) const |
| | Return the Lua identifier under the given cursor position, or an empty string if the position is not on an identifier.
|
| |
|
QString | watchExpressionForContextMenu (const QPoint &viewportPos) const |
| | Watch text for the editor context menu: trimmed selection if any, otherwise the Lua identifier at viewportPos (viewport coordinates).
|
| |
|
|
void | resizeEvent (QResizeEvent *event) override |
| | Update margins whenever Qt reports a size change.
|
| |
|
bool | eventFilter (QObject *watched, QEvent *event) override |
| | Forward Esc to LuaDebuggerDialog (keys go to viewport, not the dialog).
|
| |
Editable code editor supporting gutter breakpoints and highlighting.
◆ LuaDebuggerCodeView()
| LuaDebuggerCodeView::LuaDebuggerCodeView |
( |
QWidget * |
parent = nullptr | ) |
|
Create the code view and configure the line number gutter.
- Parameters
-
| parent | Optional parent widget for ownership. |
◆ breakpointGutterMenuRequested
| void LuaDebuggerCodeView::breakpointGutterMenuRequested |
( |
const QString & |
filename, |
|
|
qint32 |
line, |
|
|
const QPoint & |
globalPos |
|
) |
| |
|
signal |
Request an Edit / Disable (Enable) / Remove popup for the breakpoint at filename:line, anchored at globalPos.
Emitted in two cases:
- A plain left-click on the gutter that lands on a "rich" breakpoint (one carrying a condition, hit-count target, or log message). The popup guards those user-typed extras against accidental loss; plain breakpoints keep the original add-or-remove-on-click behaviour and emit breakpointToggled instead.
- A context-menu gesture (right-click on Win/Linux, Ctrl- click or two-finger trackpad tap on macOS) on any existing breakpoint, regardless of whether it carries extras. The same popup is offered, so the destructive Remove always sits behind an explicit menu choice.
◆ breakpointToggled
| void LuaDebuggerCodeView::breakpointToggled |
( |
const QString & |
filename, |
|
|
qint32 |
line, |
|
|
bool |
toggleActive |
|
) |
| |
|
signal |
Emitted when a breakpoint icon is clicked within the gutter (right margin).
- Parameters
-
| toggleActive | If true, the click should enable/disable the breakpoint without removing it (currently mapped to Shift+click); otherwise add or remove on plain click. |
◆ getFilename()
| QString LuaDebuggerCodeView::getFilename |
( |
| ) |
const |
|
inline |
Get the file path associated with this editor.
- Returns
- The file path.
◆ lineNumberAreaPaintEvent()
| void LuaDebuggerCodeView::lineNumberAreaPaintEvent |
( |
QPaintEvent * |
event | ) |
|
Paint the custom gutter that hosts line numbers and breakpoints.
- Parameters
-
| event | Exposes the area to repaint. |
◆ lineNumberAreaWidth()
| qint32 LuaDebuggerCodeView::lineNumberAreaWidth |
( |
| ) |
|
Compute the width required for the gutter, including icons.
- Returns
- Width in device-independent pixels.
◆ luaIdentifierUnderCursor()
| QString LuaDebuggerCodeView::luaIdentifierUnderCursor |
( |
const QTextCursor & |
cursor | ) |
const |
Return the Lua identifier under the given cursor position, or an empty string if the position is not on an identifier.
Lua identifiers are [A-Za-z_][A-Za-z0-9_]*. The bracket grammar that the Watch panel accepts (a.b[1], a.b["k"]) is not synthesized here — only the bare identifier at cursor's position is returned, mirroring the "double-click to select word" affordance Qt's text editors offer.
◆ setEditorFont()
| void LuaDebuggerCodeView::setEditorFont |
( |
const QFont & |
font | ) |
|
Apply a monospace font to both editor text and gutter.
- Parameters
-
◆ setFilename()
| void LuaDebuggerCodeView::setFilename |
( |
const QString & |
f | ) |
|
|
inline |
Set the file path this editor is currently hosting, for use in breakpoint management and the "edited" tab marker. The path is opaque to the editor and can be set to an empty string for unsaved buffers or those not hosting files on disk.
- Parameters
-
| f | The file path to associate with this editor. |
The documentation for this class was generated from the following files: