From 08fa70bb5fb97b07f0e85a83352fefdf10e03800 Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Fri, 1 Jun 2012 12:41:13 +0200 Subject: Add more examples for DevNet and add license text. --- FoldingCodeExample/editor.h | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 FoldingCodeExample/editor.h (limited to 'FoldingCodeExample/editor.h') diff --git a/FoldingCodeExample/editor.h b/FoldingCodeExample/editor.h new file mode 100644 index 0000000..97e176d --- /dev/null +++ b/FoldingCodeExample/editor.h @@ -0,0 +1,46 @@ +#ifndef EDITOR_H +#define EDITOR_H + +#include +#include +#include +#include +#include + +class QPaintEvent; +class QMouseEvent; + +class EditorLayout : public QPlainTextDocumentLayout +{ + Q_OBJECT + +public: + EditorLayout(QTextDocument *document) : QPlainTextDocumentLayout(document) { + } + + void emitDocumentSizeChanged() { + emit documentSizeChanged(documentSize()); + } +}; + +class Editor : public QPlainTextEdit +{ + Q_OBJECT + +public: + Editor(); + +protected: + void paintEvent(QPaintEvent *event); + void mousePressEvent(QMouseEvent *event); + +private slots: + void updateCursorPosition(); + +private: + QTextBlock foldedBlockAt(const QPoint &point); + + bool folded; +}; + +#endif -- cgit v1.2.3