| 524 | }; |
| 525 | |
| 526 | ScriptEditor::ScriptEditor(QWidget *parent) : QPlainTextEdit(parent) |
| 527 | { |
| 528 | lineNumberArea = new LineNumberArea(this); |
| 529 | highlighter = new LuaHighlighter(document()); |
| 530 | |
| 531 | connect(this, &ScriptEditor::blockCountChanged, this, &ScriptEditor::updateLineNumberAreaWidth); |
| 532 | connect(this, &ScriptEditor::updateRequest, this, &ScriptEditor::updateLineNumberArea); |
| 533 | connect(this, &ScriptEditor::cursorPositionChanged, this, &ScriptEditor::highlightCurrentLine); |
| 534 | |
| 535 | QTextOption opt = document()->defaultTextOption(); |
| 536 | opt.setFlags(opt.flags() | QTextOption::ShowTabsAndSpaces); |
| 537 | document()->setDefaultTextOption(opt); |
| 538 | setLineWrapMode(LineWrapMode::NoWrap); |
| 539 | |
| 540 | updateLineNumberAreaWidth(0); |
| 541 | highlightCurrentLine(); |
| 542 | } |
| 543 | |
| 544 | int ScriptEditor::lineNumberAreaWidth() |
| 545 | { |
nothing calls this directly
no outgoing calls
no test coverage detected