Plain-text editor with line numbers and code-editing helpers. More...
#include <editor.hpp>
Signals | |
| void | includeRequested (const QString &includeName) |
| void | themeChanged () |
Public Member Functions | |
| CustomTextEdit (QWidget *parent=nullptr) | |
| void | duplicateLine () |
| void | indentSelection () |
| void | lineNumberAreaPaintEvent (QPaintEvent *event) |
| Paint callback used by the line-number side widget. | |
| int | lineNumberAreaWidth () |
| Compute width required for current line-number digit count. | |
| void | moveLineDown () |
| void | moveLineUp () |
| void | setCompletionWords (const QStringList &words) |
| Replace the keywords offered by code completion. | |
| void | setDiagnostics (const QVector< ShaderDiagnostic > &diagnostics) |
| Replace the line markers and underlines shown for compiler messages. | |
| void | toggleComment () |
| void | unindentSelection () |
| void | updateLineNumberAreaWidth (int newBlockCount) |
Protected Member Functions | |
| void | changeEvent (QEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| void | mousePressEvent (QMouseEvent *event) override |
| void | resizeEvent (QResizeEvent *event) override |
Private Slots | |
| void | highlightCurrentLine () |
| void | matchBrackets () |
| void | updateLineNumberArea (const QRect &rect, int dy) |
Private Member Functions | |
| void | autoIndentNewLine () |
| QString | completionPrefix () const |
| bool | hasMultiLineSelection () |
| void | insertCompletion (const QString &completion) |
| void | showCompletionPopup (bool forced) |
| void | smartHome (bool shift) |
Private Attributes | |
| QCompleter * | m_completer = nullptr |
| QStringListModel * | m_completionModel = nullptr |
| QVector< ShaderDiagnostic > | m_diagnostics |
| LineNumberArea * | m_lineNumberArea = nullptr |
Plain-text editor with line numbers and code-editing helpers.
Definition at line 63 of file editor.hpp.
|
explicit |
Definition at line 198 of file editor.cpp.
References highlightCurrentLine(), insertCompletion(), LineNumberArea::LineNumberArea(), m_completer, m_completionModel, m_lineNumberArea, matchBrackets(), updateLineNumberArea(), and updateLineNumberAreaWidth().
Referenced by TextEditor::init().
|
private |
Definition at line 512 of file editor.cpp.
Referenced by includeRequested(), and keyPressEvent().
|
overrideprotected |
Definition at line 217 of file editor.cpp.
References m_lineNumberArea, matchBrackets(), and themeChanged().
Referenced by includeRequested().
|
private |
Definition at line 251 of file editor.cpp.
Referenced by includeRequested(), insertCompletion(), and showCompletionPopup().
| void CustomTextEdit::duplicateLine | ( | ) |
Definition at line 557 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
|
private |
Definition at line 450 of file editor.cpp.
Referenced by includeRequested(), and keyPressEvent().
|
privateslot |
Definition at line 346 of file editor.cpp.
References matchBrackets().
Referenced by CustomTextEdit(), and includeRequested().
|
signal |
References autoIndentNewLine(), changeEvent(), completionPrefix(), duplicateLine(), hasMultiLineSelection(), highlightCurrentLine(), indentSelection(), insertCompletion(), keyPressEvent(), matchBrackets(), mousePressEvent(), moveLineDown(), moveLineUp(), resizeEvent(), showCompletionPopup(), smartHome(), toggleComment(), unindentSelection(), and updateLineNumberArea().
Referenced by mousePressEvent().
| void CustomTextEdit::indentSelection | ( | ) |
Definition at line 459 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
|
private |
Definition at line 267 of file editor.cpp.
References completionPrefix().
Referenced by CustomTextEdit(), and includeRequested().
|
overrideprotected |
Definition at line 689 of file editor.cpp.
References autoIndentNewLine(), duplicateLine(), hasMultiLineSelection(), indentSelection(), isOpenBracket(), m_completer, matchingBracket(), moveLineDown(), moveLineUp(), showCompletionPopup(), smartHome(), toggleComment(), and unindentSelection().
Referenced by includeRequested().
| void CustomTextEdit::lineNumberAreaPaintEvent | ( | QPaintEvent * | event | ) |
Paint callback used by the line-number side widget.
Definition at line 313 of file editor.cpp.
References diagnosticColor(), m_diagnostics, and m_lineNumberArea.
Referenced by LineNumberArea::paintEvent().
| int CustomTextEdit::lineNumberAreaWidth | ( | ) |
Compute width required for current line-number digit count.
Definition at line 227 of file editor.cpp.
Referenced by resizeEvent(), LineNumberArea::sizeHint(), and updateLineNumberAreaWidth().
|
privateslot |
Definition at line 366 of file editor.cpp.
References currentLineBackground(), diagnosticColor(), isOpenBracket(), m_diagnostics, and matchingBracket().
Referenced by changeEvent(), CustomTextEdit(), highlightCurrentLine(), includeRequested(), and setDiagnostics().
|
overrideprotected |
Definition at line 867 of file editor.cpp.
References includeRequested().
Referenced by includeRequested().
| void CustomTextEdit::moveLineDown | ( | ) |
Definition at line 593 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
| void CustomTextEdit::moveLineUp | ( | ) |
Definition at line 569 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
|
overrideprotected |
Definition at line 307 of file editor.cpp.
References lineNumberAreaWidth(), and m_lineNumberArea.
Referenced by includeRequested().
| void CustomTextEdit::setCompletionWords | ( | const QStringList & | words | ) |
Replace the keywords offered by code completion.
Definition at line 244 of file editor.cpp.
References m_completionModel.
Referenced by TextEditor::updateCompletionWords().
| void CustomTextEdit::setDiagnostics | ( | const QVector< ShaderDiagnostic > & | diagnostics | ) |
Replace the line markers and underlines shown for compiler messages.
Definition at line 238 of file editor.cpp.
References m_diagnostics, m_lineNumberArea, and matchBrackets().
Referenced by TextEditor::setCompilePending(), and TextEditor::setCompileResult().
|
private |
Definition at line 278 of file editor.cpp.
References completionPrefix(), and m_completer.
Referenced by includeRequested(), and keyPressEvent().
|
private |
Definition at line 665 of file editor.cpp.
Referenced by includeRequested(), and keyPressEvent().
|
signal |
Referenced by changeEvent(), and TextEditor::init().
| void CustomTextEdit::toggleComment | ( | ) |
Definition at line 616 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
| void CustomTextEdit::unindentSelection | ( | ) |
Definition at line 480 of file editor.cpp.
Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().
|
privateslot |
Definition at line 297 of file editor.cpp.
References m_lineNumberArea, and updateLineNumberAreaWidth().
Referenced by CustomTextEdit(), and includeRequested().
| void CustomTextEdit::updateLineNumberAreaWidth | ( | int | newBlockCount | ) |
Definition at line 295 of file editor.cpp.
References lineNumberAreaWidth().
Referenced by CustomTextEdit(), and updateLineNumberArea().
|
private |
Definition at line 111 of file editor.hpp.
Referenced by CustomTextEdit(), keyPressEvent(), and showCompletionPopup().
|
private |
Definition at line 112 of file editor.hpp.
Referenced by CustomTextEdit(), and setCompletionWords().
|
private |
Definition at line 110 of file editor.hpp.
Referenced by lineNumberAreaPaintEvent(), matchBrackets(), and setDiagnostics().
|
private |
Definition at line 109 of file editor.hpp.
Referenced by changeEvent(), CustomTextEdit(), lineNumberAreaPaintEvent(), resizeEvent(), setDiagnostics(), and updateLineNumberArea().