-
Notifications
You must be signed in to change notification settings - Fork 0
/
notebox.h
61 lines (45 loc) · 1009 Bytes
/
notebox.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
#ifndef _NOTEBOX_H
#define _NOTEBOX_H
//#include <QFrame>
//#include <QPixmap>
//#include <QTextCursor>
//class QTextEdit;
//class QHBoxLayout;
#include <QtGui>
#include "highlighter.h"
/**
* @internal Used to display the numbers.
*/
class NumberBar : public QWidget
{
Q_OBJECT;
public:
NumberBar(QWidget *parent);
void setTextEdit(QTextEdit *edit);
//void paintEvent(QPaintEvent *ev);
private slots:
void setBarWidth(int);
private:
void paintEvent(QPaintEvent *);
QTextEdit *edit;
};
/**
* Displays a QTextEdit with line numbers.
*/
class NoteBox : public QFrame
{
Q_OBJECT;
public:
NoteBox(QWidget *parent=NULL);
QTextEdit *textEdit() { return view; }
void setHighlight(bool toggle);
QString path;
protected slots:
void highlightCurrentLine();
private:
QTextEdit *view;
Highlighter *highlighter;
NumberBar *numbers;
QHBoxLayout *box;
};
#endif // _NOTEBOX_H