-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubwindow.h
52 lines (39 loc) · 1.19 KB
/
subwindow.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
#ifndef SUBWINDOW_H
#define SUBWINDOW_H
#include <QObject>
#include <QTextEdit>
#include <QMainWindow>
#include <QMdiArea>
class Subwindow : public QTextEdit
{
Q_OBJECT
public:
Subwindow();
void newFile();
bool save();
bool saveAs();
bool saveFile(const QString &fileName);
bool loadFile(const QString &fileName);
void align(Qt::Alignment position);
void list(QTextListFormat::Style format);
QString currentFileName();
QString currentFile() { return curFile; }
public slots:
bool find(QString query, bool caseSensitive, bool wholeWords);
void replace(QString what, QString with, bool caseSensitive, bool wholeWords);
void replaceAll(QString what, QString with, bool caseSensitive, bool wholeWords);
signals:
void findResultReady(QString message);
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void documentWasModified();
private:
bool maybeSave();
void setCurrentFile(const QString &fileName);
void moveCursorTo(int positionInText);
QTextDocument::FindFlags getSearchOptionsFromFlags(bool caseSensitive, bool wholeWords);
QString curFile;
bool isUntitled;
};
#endif // SUBWINDOW_H