SILICON
Loading...
Searching...
No Matches
CodeEditor Class Reference

#include <codeEditor.hpp>

Inheritance diagram for CodeEditor:
Collaboration diagram for CodeEditor:

Public Member Functions

 CodeEditor (QWidget *parent=nullptr)
void setFileType (SILICON::project::DocumentType type)
void clearFileType ()
void zoomBy (int steps)
 Adjusts text and line-number size by the given number of points.
const std::optional< SILICON::project::DocumentType > & fileType () const
QString completionPrefix () const

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
void resizeEvent (QResizeEvent *event) override
void changeEvent (QEvent *event) override
void keyPressEvent (QKeyEvent *event) override
void wheelEvent (QWheelEvent *event) override

Private Member Functions

int lineNumberAreaWidth () const
void paintLineNumberArea (QPaintEvent *event)
QFont lineNumberFont () const
void updateLineNumberAreaWidth ()
void updateLineNumberAreaGeometry ()
void refreshTheme ()
void rebuildCompletionCandidates ()
void rebuildIndentationTriggers ()
int currentIndentWidth () const
void updateIndentationSettings ()
void showCompletion (bool explicitRequest)
void insertCompletion (const QString &completion)
bool insertAutoPair (QChar typed)
bool removeEmptyPair ()
bool expandPairedDelimiters ()
void indentCurrentLine ()
void dedentSelection ()
bool currentLineMatchesIndentationTrigger () const
bool isWordDelimiter (QChar character) const

Private Attributes

CodeLineNumberArea * lineNumberArea
CodeSyntaxHighlighter * syntaxHighlighter
QCompleter * completer
QStringListModel * completionModel
std::vector< QRegularExpression > indentationTriggers
std::optional< SILICON::project::DocumentType > fileTypeValue
qreal zoomFontPointSize = 0.0
CallbackScope callbacks

Friends

class CodeLineNumberArea

Detailed Description

Metadata-driven source editor with highlighting and completion.

Definition at line 47 of file codeEditor.hpp.

Constructor & Destructor Documentation

◆ CodeEditor()

CodeEditor ( QWidget * parent = nullptr)
explicit

Definition at line 85 of file codeEditor.cpp.

Member Function Documentation

◆ changeEvent()

void changeEvent ( QEvent * event)
overrideprotected

Definition at line 617 of file codeEditor.cpp.

◆ clearFileType()

void clearFileType ( )

Definition at line 138 of file codeEditor.cpp.

◆ completionPrefix()

QString completionPrefix ( ) const
nodiscard

Definition at line 279 of file codeEditor.cpp.

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent * event)
overrideprotected

Definition at line 501 of file codeEditor.cpp.

◆ currentIndentWidth()

int currentIndentWidth ( ) const
nodiscardprivate

Definition at line 644 of file codeEditor.cpp.

◆ currentLineMatchesIndentationTrigger()

bool currentLineMatchesIndentationTrigger ( ) const
nodiscardprivate

Definition at line 197 of file codeEditor.cpp.

◆ dedentSelection()

void dedentSelection ( )
private

Definition at line 659 of file codeEditor.cpp.

◆ expandPairedDelimiters()

bool expandPairedDelimiters ( )
nodiscardprivate

Definition at line 383 of file codeEditor.cpp.

◆ fileType()

const std::optional< SILICON::project::DocumentType > & fileType ( ) const
nodiscard

Definition at line 148 of file codeEditor.cpp.

◆ indentCurrentLine()

void indentCurrentLine ( )
private

Definition at line 205 of file codeEditor.cpp.

◆ insertAutoPair()

bool insertAutoPair ( QChar typed)
nodiscardprivate

Definition at line 325 of file codeEditor.cpp.

◆ insertCompletion()

void insertCompletion ( const QString & completion)
private

Definition at line 312 of file codeEditor.cpp.

◆ isWordDelimiter()

bool isWordDelimiter ( QChar character) const
nodiscardprivate

Definition at line 267 of file codeEditor.cpp.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 417 of file codeEditor.cpp.

◆ lineNumberAreaWidth()

int lineNumberAreaWidth ( ) const
nodiscardprivate

Definition at line 578 of file codeEditor.cpp.

◆ lineNumberFont()

QFont lineNumberFont ( ) const
nodiscardprivate

Definition at line 570 of file codeEditor.cpp.

◆ paintLineNumberArea()

void paintLineNumberArea ( QPaintEvent * event)
private

Definition at line 586 of file codeEditor.cpp.

◆ rebuildCompletionCandidates()

void rebuildCompletionCandidates ( )
private

Definition at line 158 of file codeEditor.cpp.

◆ rebuildIndentationTriggers()

void rebuildIndentationTriggers ( )
private

Definition at line 175 of file codeEditor.cpp.

◆ refreshTheme()

void refreshTheme ( )
private

Definition at line 153 of file codeEditor.cpp.

◆ removeEmptyPair()

bool removeEmptyPair ( )
nodiscardprivate

Definition at line 364 of file codeEditor.cpp.

◆ resizeEvent()

void resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 611 of file codeEditor.cpp.

◆ setFileType()

void setFileType ( SILICON::project::DocumentType type)

Definition at line 121 of file codeEditor.cpp.

◆ showCompletion()

void showCompletion ( bool explicitRequest)
private

Definition at line 289 of file codeEditor.cpp.

◆ updateIndentationSettings()

void updateIndentationSettings ( )
private

Definition at line 652 of file codeEditor.cpp.

◆ updateLineNumberAreaGeometry()

void updateLineNumberAreaGeometry ( )
private

Definition at line 637 of file codeEditor.cpp.

◆ updateLineNumberAreaWidth()

void updateLineNumberAreaWidth ( )
private

Definition at line 631 of file codeEditor.cpp.

◆ wheelEvent()

void wheelEvent ( QWheelEvent * event)
overrideprotected

Definition at line 536 of file codeEditor.cpp.

◆ zoomBy()

void zoomBy ( int steps)

Adjusts text and line-number size by the given number of points.

Definition at line 549 of file codeEditor.cpp.

◆ CodeLineNumberArea

friend class CodeLineNumberArea
friend

Definition at line 69 of file codeEditor.hpp.

Member Data Documentation

◆ callbacks

CallbackScope callbacks
private

Definition at line 98 of file codeEditor.hpp.

◆ completer

QCompleter* completer
private

Definition at line 93 of file codeEditor.hpp.

◆ completionModel

QStringListModel* completionModel
private

Definition at line 94 of file codeEditor.hpp.

◆ fileTypeValue

std::optional<SILICON::project::DocumentType> fileTypeValue
private

Definition at line 96 of file codeEditor.hpp.

◆ indentationTriggers

std::vector<QRegularExpression> indentationTriggers
private

Definition at line 95 of file codeEditor.hpp.

◆ lineNumberArea

CodeLineNumberArea* lineNumberArea
private

Definition at line 91 of file codeEditor.hpp.

◆ syntaxHighlighter

CodeSyntaxHighlighter* syntaxHighlighter
private

Definition at line 92 of file codeEditor.hpp.

◆ zoomFontPointSize

qreal zoomFontPointSize = 0.0
private

Definition at line 97 of file codeEditor.hpp.


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