Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
PlainTextEditMdi.h
Go to the documentation of this file.
1#pragma once
2
3#include <QPlainTextEdit>
5#include <ami/iface/global.h>
6
7class QPaintEvent;
8class QResizeEvent;
9class QSize;
10class QWidget;
11class QSettings;
12
13namespace sf
14{
15
17{
18 public:
23
27 explicit PlainTextEditMdi(QPlainTextEdit* editor);
28
35 void setEditor(QPlainTextEdit* edit, QWidget* container = nullptr);
36
37 // MultiDocInterface interface method.
38 void newFile() override;
39
40 // Can be overridden to change the suffix.
41 [[nodiscard]] virtual QString newFileName() const;
42
43 // MultiDocInterface interface method.
44 bool loadFile(const QString& filename) override;
45
46 // MultiDocInterface interface method.
47 bool save() override;
48
49 // MultiDocInterface interface method.
50 bool saveAs() override;
51
52 // MultiDocInterface interface method.
53 bool saveFile(const QString& fileName);
54
55 // MultiDocInterface interface method.
56 [[nodiscard]] bool isModified() const override;
57
58 // MultiDocInterface interface method.
59 [[nodiscard]] QString userFriendlyCurrentFile() const override;
60
61 // MultiDocInterface interface method.
62 [[nodiscard]] QString currentFile() const override;
63
64 // MultiDocInterface interface method.
65 [[nodiscard]] bool hasSelection() const override;
66
67 // MultiDocInterface interface method.
68 [[nodiscard]] bool isUndoRedoEnabled() const override;
69
70 // MultiDocInterface interface method.
71 [[nodiscard]] bool isUndoAvailable() const override;
72
73 // MultiDocInterface interface method.
74 [[nodiscard]] bool isRedoAvailable() const override;
75
76 // MultiDocInterface interface method.
77 void cut() override;
78
79 // MultiDocInterface interface method.
80 void copy() override;
81
82 // MultiDocInterface interface method.
83 void paste() override;
84
85 // MultiDocInterface interface method.
86 void undo() override;
87
88 // MultiDocInterface interface method.
89 void redo() override;
90
91 private:
92 void documentWasModified();
93
94 void setCurrentFile(const QString& fileName);
95
96 [[nodiscard]] QString strippedName(const QString& fullFileName) const;
97
98 QString curFile;
99
100 bool isUntitled{true};
101
102 QPlainTextEdit* _editor{nullptr};
103
104 QWidget* _container{nullptr};
105};
106
107}// namespace sf
#define _AMI_CLASS
Definition ami/iface/global.h:35
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
Definition PlainTextEditMdi.h:17
bool isRedoAvailable() const override
Pure virtual needs to be implemented.
bool loadFile(const QString &filename) override
Pure virtual needs to be implemented.
bool isModified() const override
Pure virtual needs to be implemented.
void copy() override
Pure virtual needs to be implemented.
void cut() override
Pure virtual needs to be implemented.
PlainTextEditMdi()
Default constructor.
bool saveAs() override
Pure virtual needs to be implemented.
QString currentFile() const override
Pure virtual needs to be implemented.
void redo() override
Pure virtual needs to be implemented.
virtual QString newFileName() const
bool isUndoRedoEnabled() const override
Pure virtual needs to be implemented.
QString userFriendlyCurrentFile() const override
Pure virtual needs to be implemented.
bool save() override
Pure virtual needs to be implemented.
bool isUndoAvailable() const override
Pure virtual needs to be implemented.
PlainTextEditMdi(QPlainTextEdit *editor)
Initializing constructor.
bool saveFile(const QString &fileName)
void undo() override
Pure virtual needs to be implemented.
void newFile() override
Pure virtual needs to be implemented.
bool hasSelection() const override
Pure virtual needs to be implemented.
void setEditor(QPlainTextEdit *edit, QWidget *container=nullptr)
Sets the editor for the interface to work on to set the title.
void paste() override
Pure virtual needs to be implemented.
Definition Application.h:10