parent
47ee1857cd
commit
45b7d4fcbc
4 changed files with 105 additions and 14 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define CODEEDITOR_H
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <set>
|
||||
|
||||
class CodeEditor : public QPlainTextEdit
|
||||
{
|
||||
|
|
@ -12,6 +13,8 @@ public:
|
|||
void gutterAreaPaintEvent(QPaintEvent *event);
|
||||
int gutterAreaWidth();
|
||||
|
||||
void addErrorMarker(int position, int length);
|
||||
void clearErrorMarkers();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
|
|
@ -23,9 +26,17 @@ private slots:
|
|||
void updateGutterAreaWidth(int newBlockCount);
|
||||
void highlightCurrentLine();
|
||||
void updateGutterArea(const QRect &, int);
|
||||
void onTextChanged();
|
||||
|
||||
private:
|
||||
QWidget *gutterArea;
|
||||
|
||||
QTextEdit::ExtraSelection currentLine;
|
||||
QList<QTextEdit::ExtraSelection> errorMarkers;
|
||||
|
||||
std::set<int> errorLines;
|
||||
|
||||
void updateExtraSelections();
|
||||
};
|
||||
|
||||
#endif // CODEEDITOR_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue