ACMX 2.139.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
CustomTextEdit Class Reference

Plain-text editor with line numbers and code-editing helpers. More...

#include <editor.hpp>

Inheritance diagram for CustomTextEdit:

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

Detailed Description

Plain-text editor with line numbers and code-editing helpers.

Definition at line 63 of file editor.hpp.

Constructor & Destructor Documentation

◆ CustomTextEdit()

CustomTextEdit::CustomTextEdit ( QWidget * parent = nullptr)
explicit

Member Function Documentation

◆ autoIndentNewLine()

void CustomTextEdit::autoIndentNewLine ( )
private

Definition at line 512 of file editor.cpp.

Referenced by includeRequested(), and keyPressEvent().

◆ changeEvent()

void CustomTextEdit::changeEvent ( QEvent * event)
overrideprotected

Definition at line 217 of file editor.cpp.

References m_lineNumberArea, matchBrackets(), and themeChanged().

Referenced by includeRequested().

◆ completionPrefix()

QString CustomTextEdit::completionPrefix ( ) const
private

Definition at line 251 of file editor.cpp.

Referenced by includeRequested(), insertCompletion(), and showCompletionPopup().

◆ duplicateLine()

void CustomTextEdit::duplicateLine ( )

Definition at line 557 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ hasMultiLineSelection()

bool CustomTextEdit::hasMultiLineSelection ( )
private

Definition at line 450 of file editor.cpp.

Referenced by includeRequested(), and keyPressEvent().

◆ highlightCurrentLine

void CustomTextEdit::highlightCurrentLine ( )
privateslot

Definition at line 346 of file editor.cpp.

References matchBrackets().

Referenced by CustomTextEdit(), and includeRequested().

◆ includeRequested

◆ indentSelection()

void CustomTextEdit::indentSelection ( )

Definition at line 459 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ insertCompletion()

void CustomTextEdit::insertCompletion ( const QString & completion)
private

Definition at line 267 of file editor.cpp.

References completionPrefix().

Referenced by CustomTextEdit(), and includeRequested().

◆ keyPressEvent()

◆ lineNumberAreaPaintEvent()

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().

◆ lineNumberAreaWidth()

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().

◆ matchBrackets

void CustomTextEdit::matchBrackets ( )
privateslot

◆ mousePressEvent()

void CustomTextEdit::mousePressEvent ( QMouseEvent * event)
overrideprotected

Definition at line 867 of file editor.cpp.

References includeRequested().

Referenced by includeRequested().

◆ moveLineDown()

void CustomTextEdit::moveLineDown ( )

Definition at line 593 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ moveLineUp()

void CustomTextEdit::moveLineUp ( )

Definition at line 569 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ resizeEvent()

void CustomTextEdit::resizeEvent ( QResizeEvent * event)
overrideprotected

Definition at line 307 of file editor.cpp.

References lineNumberAreaWidth(), and m_lineNumberArea.

Referenced by includeRequested().

◆ setCompletionWords()

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().

◆ setDiagnostics()

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().

◆ showCompletionPopup()

void CustomTextEdit::showCompletionPopup ( bool forced)
private

Definition at line 278 of file editor.cpp.

References completionPrefix(), and m_completer.

Referenced by includeRequested(), and keyPressEvent().

◆ smartHome()

void CustomTextEdit::smartHome ( bool shift)
private

Definition at line 665 of file editor.cpp.

Referenced by includeRequested(), and keyPressEvent().

◆ themeChanged

void CustomTextEdit::themeChanged ( )
signal

Referenced by changeEvent(), and TextEditor::init().

◆ toggleComment()

void CustomTextEdit::toggleComment ( )

Definition at line 616 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ unindentSelection()

void CustomTextEdit::unindentSelection ( )

Definition at line 480 of file editor.cpp.

Referenced by includeRequested(), TextEditor::init(), and keyPressEvent().

◆ updateLineNumberArea

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

Definition at line 297 of file editor.cpp.

References m_lineNumberArea, and updateLineNumberAreaWidth().

Referenced by CustomTextEdit(), and includeRequested().

◆ updateLineNumberAreaWidth()

void CustomTextEdit::updateLineNumberAreaWidth ( int newBlockCount)

Definition at line 295 of file editor.cpp.

References lineNumberAreaWidth().

Referenced by CustomTextEdit(), and updateLineNumberArea().

Member Data Documentation

◆ m_completer

QCompleter* CustomTextEdit::m_completer = nullptr
private

Definition at line 111 of file editor.hpp.

Referenced by CustomTextEdit(), keyPressEvent(), and showCompletionPopup().

◆ m_completionModel

QStringListModel* CustomTextEdit::m_completionModel = nullptr
private

Definition at line 112 of file editor.hpp.

Referenced by CustomTextEdit(), and setCompletionWords().

◆ m_diagnostics

QVector<ShaderDiagnostic> CustomTextEdit::m_diagnostics
private

Definition at line 110 of file editor.hpp.

Referenced by lineNumberAreaPaintEvent(), matchBrackets(), and setDiagnostics().

◆ m_lineNumberArea

LineNumberArea* CustomTextEdit::m_lineNumberArea = nullptr
private

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