Cppcheck
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
CodeEditor Class Reference

#include <codeeditor.h>

Inheritance diagram for CodeEditor:

Public Member Functions

 CodeEditor (QWidget *parent)
 
 CodeEditor (const CodeEditor &)=delete
 
CodeEditoroperator= (const CodeEditor &)=delete
 
 ~CodeEditor () override
 
void lineNumberAreaPaintEvent (const QPaintEvent *event)
 
int lineNumberAreaWidth ()
 
void setStyle (const CodeEditorStyle &newStyle)
 
void setError (const QString &code, int errorLine, const QStringList &symbols)
 Set source code to show, goto error line and highlight that line. More...
 
void setError (int errorLine, const QStringList &symbols)
 Goto another error in existing source file. More...
 
void setFileName (const QString &fileName)
 
const QString & getFileName () const
 
void clear ()
 

Protected Member Functions

void resizeEvent (QResizeEvent *event) override
 

Private Slots

void updateLineNumberAreaWidth (int newBlockCount)
 
void highlightErrorLine ()
 
void updateLineNumberArea (const QRect &, int)
 

Private Member Functions

QString generateStyleString ()
 

Private Attributes

QWidget * mLineNumberArea
 
HighlightermHighlighter
 
CodeEditorStylemWidgetStyle
 
int mErrorPosition
 
QString mFileName
 

Detailed Description

Definition at line 85 of file codeeditor.h.

Constructor & Destructor Documentation

◆ CodeEditor() [1/2]

CodeEditor::CodeEditor ( QWidget *  parent)
explicit

◆ CodeEditor() [2/2]

CodeEditor::CodeEditor ( const CodeEditor )
delete

◆ ~CodeEditor()

CodeEditor::~CodeEditor ( )
override

Definition at line 305 of file codeeditor.cpp.

References mWidgetStyle.

Member Function Documentation

◆ clear()

void CodeEditor::clear ( )
inline

Definition at line 121 of file codeeditor.h.

References mFileName.

◆ generateStyleString()

QString CodeEditor::generateStyleString ( )
private

◆ getFileName()

const QString& CodeEditor::getFileName ( ) const
inline

Definition at line 117 of file codeeditor.h.

References mFileName.

◆ highlightErrorLine

void CodeEditor::highlightErrorLine ( )
privateslot

Definition at line 403 of file codeeditor.cpp.

References CodeEditorStyle::highlightBGColor, mErrorPosition, and mWidgetStyle.

Referenced by setError(), and setStyle().

◆ lineNumberAreaPaintEvent()

void CodeEditor::lineNumberAreaPaintEvent ( const QPaintEvent *  event)

◆ lineNumberAreaWidth()

int CodeEditor::lineNumberAreaWidth ( )

◆ operator=()

CodeEditor& CodeEditor::operator= ( const CodeEditor )
delete

◆ resizeEvent()

void CodeEditor::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 396 of file codeeditor.cpp.

References lineNumberAreaWidth(), and mLineNumberArea.

◆ setError() [1/2]

void CodeEditor::setError ( const QString &  code,
int  errorLine,
const QStringList &  symbols 
)

Set source code to show, goto error line and highlight that line.

Parameters
codeThe source code.
errorLineline number
symbolsthe related symbols, these are marked

Definition at line 335 of file codeeditor.cpp.

References getPos(), highlightErrorLine(), mErrorPosition, mHighlighter, and Highlighter::setSymbols().

Referenced by StyleEditDialog::StyleEditDialog().

◆ setError() [2/2]

void CodeEditor::setError ( int  errorLine,
const QStringList &  symbols 
)

Goto another error in existing source file.

Parameters
errorLineline number
symbolsthe related symbols, these are marked

Definition at line 350 of file codeeditor.cpp.

References getPos(), highlightErrorLine(), mErrorPosition, mHighlighter, and Highlighter::setSymbols().

◆ setFileName()

void CodeEditor::setFileName ( const QString &  fileName)
inline

Definition at line 113 of file codeeditor.h.

References mFileName.

◆ setStyle()

void CodeEditor::setStyle ( const CodeEditorStyle newStyle)

◆ updateLineNumberArea

void CodeEditor::updateLineNumberArea ( const QRect &  rect,
int  dy 
)
privateslot

Definition at line 385 of file codeeditor.cpp.

References mLineNumberArea, and updateLineNumberAreaWidth().

Referenced by CodeEditor().

◆ updateLineNumberAreaWidth

void CodeEditor::updateLineNumberAreaWidth ( int  newBlockCount)
privateslot

Definition at line 380 of file codeeditor.cpp.

References lineNumberAreaWidth().

Referenced by CodeEditor(), and updateLineNumberArea().

Member Data Documentation

◆ mErrorPosition

int CodeEditor::mErrorPosition
private

Definition at line 141 of file codeeditor.h.

Referenced by CodeEditor(), highlightErrorLine(), and setError().

◆ mFileName

QString CodeEditor::mFileName
private

Definition at line 142 of file codeeditor.h.

Referenced by clear(), getFileName(), and setFileName().

◆ mHighlighter

Highlighter* CodeEditor::mHighlighter
private

Definition at line 139 of file codeeditor.h.

Referenced by CodeEditor(), setError(), and setStyle().

◆ mLineNumberArea

QWidget* CodeEditor::mLineNumberArea
private

◆ mWidgetStyle

CodeEditorStyle* CodeEditor::mWidgetStyle
private

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