diff options
Diffstat (limited to 'src/main-view/RecordEditor.h')
-rw-r--r-- | src/main-view/RecordEditor.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main-view/RecordEditor.h b/src/main-view/RecordEditor.h new file mode 100644 index 0000000..40b5dc5 --- /dev/null +++ b/src/main-view/RecordEditor.h @@ -0,0 +1,46 @@ +#ifndef RECORD_EDITOR_H +#define RECORD_EDITOR_H + +#include <QtWidgets> + +#include "FieldContentPainter.h" + +class RecordEditor: public QTextEdit, public FieldContentPainter +{ +Q_OBJECT + +private: + static const int ThumbnailSize = 25; + static const int MinWidth = 150; + static const int MaxWidth = 400; + static const float EditorWidthIncrease; + +public: + RecordEditor(QWidget* parent, const QRect& cellRect); + QRect getCellRect() const { return cellRect; } + void startDrawing(); + void endDrawing(); + void drawText(const QString& text); + void drawImage(const QString& filePath); + void insertImage(int cursorPos, const QString& filePath); + QString getText() const; + +protected: + QSize sizeHint() const; + +private: + int getEditorWidth() const; + int getEditorHeight() const; + void updatePos(); + bool textWrapped() const; + void moveCursor(int cursorPos); + +public slots: + void updateEditor(); + +private: + QRect cellRect; + bool enabledSizeUpdates; +}; +#endif + |