From 33443fe7f672d74d819dfc633e7be0ecb82beda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B3=D0=BE=D1=80=20=D0=93=D0=B0=D0=BB=D0=BA=D0=B8?= =?UTF-8?q?=D0=BD?= Date: Wed, 13 Jan 2021 19:23:17 +0000 Subject: [PATCH] Add new file --- codeeditor.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 codeeditor.h diff --git a/codeeditor.h b/codeeditor.h new file mode 100644 index 0000000..a00c549 --- /dev/null +++ b/codeeditor.h @@ -0,0 +1,28 @@ +#ifndef CODEEDITOR_H +#define CODEEDITOR_H + +#include +#include + +class CodeEditor : public QPlainTextEdit +{ + Q_OBJECT +public: + CodeEditor(QWidget *parent = 0); + + void lineNumberAreaPaintEvent(QPaintEvent* event); + int lineNumberAreaWidth(); + +protected: + void resizeEvent(QResizeEvent* event) override; + +private slots: + void updateLineNumberAreaWidth(int newBlockCount); + void highlightCurrentLine(); + void updateLineNumberArea(const QRect& rect, int dy); + +private: + QWidget *lineNumberArea; +}; + +#endif // CODEEDITOR_H \ No newline at end of file -- GitLab