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
>
4
#include <
misc/qt/ObjectExtension.h
>
5
6
class
QPaintEvent;
7
class
QResizeEvent;
8
class
QSize;
9
class
QWidget;
10
class
QSettings;
11
12
namespace
sf
13
{
14
15
class
_MISC_CLASS
Editor
16
:
public
QPlainTextEdit
17
,
public
ObjectExtension
18
{
19
Q_OBJECT
20
21
public
:
22
class
_MISC_CLASS
Configuration
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
48
void
setConfiguration
(
const
Configuration
& cfg);
49
50
void
lineNumberAreaPaintEvent
(QPaintEvent* event);
51
52
int
lineNumberAreaWidth
();
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
ObjectExtension.h
sf::Editor::Configuration
Definition
Editor.h:23
sf::Editor::Configuration::storeSettings
void storeSettings(bool save)
sf::Editor::Configuration::Configuration
Configuration(QSettings *settings=nullptr)
sf::Editor
Definition
Editor.h:18
sf::Editor::lineNumberAreaPaintEvent
void lineNumberAreaPaintEvent(QPaintEvent *event)
sf::Editor::canClose
virtual bool canClose()
Called on a close event. To prevent losing changes made to the document.
sf::Editor::~Editor
~Editor() override
Destructor.
sf::Editor::isRequiredProperty
bool isRequiredProperty(const QString &name) override
Overridden from base class ObjectExtension.
sf::Editor::lineNumberAreaWidth
int lineNumberAreaWidth()
sf::Editor::resizeEvent
void resizeEvent(QResizeEvent *event) override
Overridden from base class QPlainTextEdit.
sf::Editor::closeEvent
void closeEvent(QCloseEvent *event) override
Overridden from base class QPlainTextEdit.
sf::Editor::Editor
Editor(QWidget *parent=nullptr)
Constructor.
sf::Editor::setConfiguration
void setConfiguration(const Configuration &cfg)
sf::ObjectExtension
Interface class to multiple inherit when the sf::FormWriter class needs to be restricted in writing o...
Definition
ObjectExtension.h:17
global.h
_MISC_CLASS
#define _MISC_CLASS
Definition
misc/global.h:40
sf
Definition
Application.h:10
src
com
misc
qt
Editor.h
Generated by
1.9.8