-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexteditor.h
82 lines (76 loc) · 1.83 KB
/
texteditor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef TEXTEDITOR_H
#define TEXTEDITOR_H
#include <QMainWindow>
#include <QtWidgets>
#include <QClipboard>
class TextEditor : public QMainWindow
{
Q_OBJECT
private:
QTextEdit *mainText;
QLabel *title;
QFile textFile;
QString filePath;
bool hasFile = false;
bool fileSaved = true;
// The menu
QMenu *file;
QMenu *edit;
QMenu *view;
QMenu *help;
// The actions
QAction *newFileAction;
QAction *openFileAction;
QAction *saveFileAction;
QAction *closeFileAction;
QAction *quitAction;
//--
QAction *undoAction;
QAction *redoAction;
QAction *copyAction;
QAction *cutAction;
QAction *pasteAction;
// The dock
QDockWidget *dock;
//--
QAction *showRecentFileAction;
//--
QAction *helpAction;
// Recent files list
QListWidget *recentFilesList;
bool recentFileVisible = true;
// Functions
void createMenu();
void createActions();
void createToolBar();
void eventHandle();
void createBody();
void createDock();
void createStyle();
void checkSave();
// Static function
static QString getOnlyNameFromPath(QString path);
public:
TextEditor(QWidget *parent = nullptr);
~TextEditor();
private slots:
void newfile();
void openfile();
void savefile();
void closefile();
void quitApp();
//--
void undo();
void redo();
void copy();
void cut();
void paste();
//--
void openRecentFile();
void recentFileVisibility();
//--
void getHelp();
//--
void updateSaved();
};
#endif