Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
Editor.h
Go to the documentation of this file.
1#pragma once
2#include <QPlainTextEdit>
3#include <misc/global.h>
5
6class QPaintEvent;
7class QResizeEvent;
8class QSize;
9class QWidget;
10class QSettings;
11
12namespace sf
13{
14
16 : public QPlainTextEdit
17 , public ObjectExtension
18{
19 Q_OBJECT
20
21 public:
23 {
24 public:
25 explicit Configuration(QSettings* settings = nullptr);
26
27 void storeSettings(bool save);
28
29 QString fontType{"Monospace"};
30 int fontSize{10};
31 bool showGutter{true};
32 bool darkMode{false};
33 bool useHighLighting{true};
34
35 private:
36 QSettings* _settings;
37 };
38
42 explicit Editor(QWidget* parent = nullptr);
46 ~Editor() override;
47
49
50 void lineNumberAreaPaintEvent(QPaintEvent* event);
51
53
58 virtual bool canClose();
59
63 bool isRequiredProperty(const QString& name) override;
64
65 protected:
69 void resizeEvent(QResizeEvent* event) override;
70
74 void closeEvent(QCloseEvent* event) override;
75
76 private:
77 void updateLineNumberAreaWidth(int newBlockCount);
78
79 void highlightCurrentLine();
80
81 void updateLineNumberArea(const QRect& rect, int dy);
82
83 // Forward declaration.
84 class LineNumberArea;
85
86 struct Private;
87 Private& _p;
88};
89
90}// namespace sf
Definition Editor.h:23
void storeSettings(bool save)
Configuration(QSettings *settings=nullptr)
Definition Editor.h:18
void lineNumberAreaPaintEvent(QPaintEvent *event)
virtual bool canClose()
Called on a close event. To prevent losing changes made to the document.
~Editor() override
Destructor.
bool isRequiredProperty(const QString &name) override
Overridden from base class ObjectExtension.
int lineNumberAreaWidth()
void resizeEvent(QResizeEvent *event) override
Overridden from base class QPlainTextEdit.
void closeEvent(QCloseEvent *event) override
Overridden from base class QPlainTextEdit.
Editor(QWidget *parent=nullptr)
Constructor.
void setConfiguration(const Configuration &cfg)
Interface class to multiple inherit when the sf::FormWriter class needs to be restricted in writing o...
Definition ObjectExtension.h:17
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10