Currently gutter only shows linenumbers. Code is mostly from http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html There is a little bit included in this commit from a first try to make toobars adept to the current tab. Code #2
31 lines
539 B
C++
31 lines
539 B
C++
#ifndef CODEEDITOR_H
|
|
#define CODEEDITOR_H
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
class CodeEditor : public QPlainTextEdit
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CodeEditor(QWidget *parent = nullptr);
|
|
|
|
void gutterAreaPaintEvent(QPaintEvent *event);
|
|
int gutterAreaWidth();
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
signals:
|
|
|
|
public slots:
|
|
|
|
private slots:
|
|
void updateGutterAreaWidth(int newBlockCount);
|
|
void highlightCurrentLine();
|
|
void updateGutterArea(const QRect &, int);
|
|
|
|
private:
|
|
QWidget *gutterArea;
|
|
};
|
|
|
|
#endif // CODEEDITOR_H
|