-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyviewer.h
More file actions
46 lines (43 loc) · 1.18 KB
/
myviewer.h
File metadata and controls
46 lines (43 loc) · 1.18 KB
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
#ifndef MYVIEWER_H
#define MYVIEWER_H
#include "types.h"
#include "functions.h"
#include <QPlainTextEdit>
#include <QLineEdit>
class MyViewer : public QPlainTextEdit, public MyViewType
{
Q_OBJECT
bool image;
int idx;
public:
explicit MyViewer(QWidget *parent = 0): QPlainTextEdit(parent), MyViewType("","", nullptr) {}
MyViewer(std::string pa, std::string pat, int i = 0, QWidget *p = 0): QPlainTextEdit(p), MyViewType(pa, pat, nullptr), image(false), idx(i) {
if(isImg(path))
image = true;
rebuild();
}
virtual ~MyViewer() {}
virtual void focusInEvent(QFocusEvent *);
virtual void focusOutEvent(QFocusEvent *);
virtual void keyPressEvent(QKeyEvent *);
virtual void resizeEvent(QResizeEvent *e);
virtual void rebuild(int idx = 0);
std::string getSelected();
virtual void unFocus();
virtual int getIdxOf(std::string &) { return 0;}
virtual void setFocus();
virtual void focus();
virtual void mark(bool);
virtual int getSelIdx();
virtual void die();
signals:
void focused();
void rebuilded();
void refresh();
void unfocused();
void itemSelectionChanged();
void stepup();
void tab();
void chlayout();
};
#endif // MYVIEWER_H