STC_editor
Qt text editor for STC markup used on cpp0x.pl
Loading...
Searching...
No Matches
CodeEditor Class Reference

Text editor widget with line numbers and support for STC markup. More...

#include <CodeEditor.h>

Inherits QPlainTextEdit.

Public Member Functions

void setSyntaxMode (SyntaxMode mode, bool rehighlightNow=true)
 Switches the highlighting of the whole document.
 
void setSyntaxModeChosenByUser (SyntaxMode mode)
 What the user chose in the "Syntax" menu: applied now and remembered for the current file, so it is the same after the file is opened again (.txt can be an STC article or a plain note).
 

Protected Member Functions

bool isCtrlLeftClick (QMouseEvent *event) const
 methods to handle opening links on click:
 
std::optional< QString > extractImagePath (const QString &text, const QTextCursor &cursor) const
 methods to load preview of images: both local and remote:
 
bool isControlOnly (QKeyEvent *event) const
 methods to handle key pressed events:
 
void moveCursorToClickPosition (const QPoint &pos)
 methods to handle contest menu actions:
 

Detailed Description

Text editor widget with line numbers and support for STC markup.

Extends QPlainTextEdit with:

  • loading and saving files (with encoding detection) and watching them for external changes,
  • tracking which lines differ from the originally loaded content,
  • detection of code blocks (e.g. [cpp]...[/cpp]) in the document,
  • whole-document syntax modes (STC, plain text, C++, Python, XML, JSON),
  • context-menu actions, smart pasting (links, tables, rich text) and spelling suggestions.

Member Function Documentation

◆ setSyntaxMode()

void CodeEditor::setSyntaxMode ( SyntaxMode  mode,
bool  rehighlightNow = true 
)

Switches the highlighting of the whole document.

Opening a file chooses the mode by its extension, this is what the "Syntax" menu calls to override it. rehighlightNow=false is for content which is about to be replaced.


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