2015-04-22 19:33:53 +02:00
|
|
|
#ifndef CODEEDITOR_H
|
|
|
|
#define CODEEDITOR_H
|
|
|
|
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
2018-03-07 01:18:01 +01:00
|
|
|
class CodeEdit : public QPlainTextEdit {
|
2015-04-22 19:33:53 +02:00
|
|
|
public:
|
|
|
|
CodeEdit(QWidget *parent = nullptr);
|
2019-06-01 12:45:12 +02:00
|
|
|
~CodeEdit() override;
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
const QString &indentation() const;
|
|
|
|
void setIndentation(const QString &indentation);
|
|
|
|
|
|
|
|
protected:
|
2019-06-01 12:45:12 +02:00
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void handleReturn(QKeyEvent *e);
|
|
|
|
void handleDelete(QKeyEvent *e);
|
|
|
|
|
|
|
|
QString m_indentation;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline const QString &CodeEdit::indentation() const
|
|
|
|
{
|
|
|
|
return m_indentation;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void CodeEdit::setIndentation(const QString &indentation)
|
|
|
|
{
|
|
|
|
m_indentation = indentation;
|
|
|
|
}
|
|
|
|
|
2018-03-07 01:18:01 +01:00
|
|
|
} // namespace QtGui
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
#endif // CODEEDITOR_H
|