pgLab/pglab/CodeEditor.h
eelke f5145f36ed wip: codegenerator, basic widget present for showing the generated code and specifying
parameters. Some code is also generated but it is not complete yet.

minimum still required
- field assignments
- properly format and escape the query string
2018-09-18 11:54:43 +02:00

45 lines
906 B
C++

#ifndef CODEEDITOR_H
#define CODEEDITOR_H
#include <QPlainTextEdit>
#include <set>
/** This class adds some capabilities to QPlainTextEdit that are useful
* in code editor scenarios.
*/
class CodeEditor : public QPlainTextEdit
{
Q_OBJECT
public:
explicit CodeEditor(QWidget *parent = nullptr);
void gutterAreaPaintEvent(QPaintEvent *event);
int gutterAreaWidth();
void addErrorMarker(int position, int length);
void clearErrorMarkers();
protected:
void resizeEvent(QResizeEvent *event) override;
signals:
public slots:
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