| 46 | #include <QWidget> |
| 47 | |
| 48 | CodeEditor::CodeEditor(QWidget* parent) |
| 49 | : QPlainTextEdit(parent) |
| 50 | { |
| 51 | lineNumberArea = new LineNumberArea(this); |
| 52 | |
| 53 | connect(this, SIGNAL(blockCountChanged(int)), this, |
| 54 | SLOT(updateLineNumberAreaWidth(int))); |
| 55 | connect(this, SIGNAL(updateRequest(QRect, int)), this, |
| 56 | SLOT(updateLineNumberArea(QRect, int))); |
| 57 | connect(this, SIGNAL(cursorPositionChanged()), this, |
| 58 | SLOT(highlightCurrentLine())); |
| 59 | |
| 60 | updateLineNumberAreaWidth(0); |
| 61 | highlightCurrentLine(); |
| 62 | } |
| 63 | |
| 64 | int CodeEditor::lineNumberAreaWidth() |
| 65 | { |