-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeeditor.h
66 lines (52 loc) · 1.55 KB
/
codeeditor.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
#ifndef CODEEDITOR_H
#define CODEEDITOR_H
#include <QWidget>
#include <QWidget>
#include <QPlainTextEdit>
#include <QMargins>
#include "searchoptions.h"
#include <QTextDocument>
class CodeEditor : public QPlainTextEdit
{
Q_OBJECT
public:
CodeEditor(QWidget *parent );
~CodeEditor();
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
bool searchInEditorOriginal(QString text);
void findNext();
void findPrev();
void textFind();
void showGoto();
void showFind();
void showTextReplace();
QString getFindFailMsg(QString toFind);
QTextDocument::FindFlags getFindFlags();
bool searchInEditor(QString text);
void delete_current_line();
void duplicate_line();
QString replaceAll(QString findStr, QString replaceStr);
bool replaceCurrent(QString findStr,QString replaceStr);
QString replace(QString findStr,QString replaceStr);
void selectCursor(int pos,int len);
void selectCursor2(int pos,int len);
protected:
void resizeEvent(QResizeEvent *event) override;
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void highlightCurrentLine();
void updateLineNumberArea(const QRect &, int);
private:
QWidget *lineNumberArea;
QMargins lnaMargins;//lineNumberArea margins
SearchOptions searchOption;
friend class SearchDialog;
// QWidget interface
protected:
void dropEvent(QDropEvent *event) override;
Q_SIGNALS:
void dropFile(QString filePath);
void statusMessageChange(QString msg);
};
#endif // CODEEDITOR_H