-
Notifications
You must be signed in to change notification settings - Fork 41
/
editortab.h
137 lines (97 loc) · 2.85 KB
/
editortab.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef EDITORTAB_H
#define EDITORTAB_H
#include <QAbstractItemView>
#include <QAbstractTextDocumentLayout>
#include <QAction>
#include <QClipboard>
#include <QDebug>
#include <QFileInfo>
#include <QMenu>
#include <QMessageBox>
#include <QMouseEvent>
#include <QObject>
#include <QScrollArea>
#include <QSortFilterProxyModel>
#include <QStandardItem>
#include <QStyleFactory>
#include <QTextBrowser>
#include <QTextEdit>
#include <QUndoStack>
#include <QUndoView>
#include <QWidget>
#include "comboboxdelegate.h"
#include "comboboxdelegatebool.h"
#include "commands.h"
#include "dommodel.h"
#include "lineeditdelegate.h"
#include "mytreeview.h"
namespace Ui {
class EditorTab;
}
class EditorTab : public QWidget {
Q_OBJECT
public:
explicit EditorTab(DomModel* model, QWidget* parent = 0);
~EditorTab();
void changeDataType(QString txt);
void setTipsFixedHeight();
void initBoolWidget(QModelIndex index);
QTextBrowser* lblTips;
MyTreeView* treeView;
int getCurrentRow();
QSortFilterProxyModel* proxyModel;
bool isExpanded();
void expand();
DomModel* getModel();
void setModel(DomModel* m);
QString getPath();
QString getFileName();
void setPath(QString p);
QModelIndex currentIndex() const;
QUndoStack* getUndoStack();
QUndoView* undoView;
void view_collapse(const QModelIndex index, DomModel* model);
void view_expand(const QModelIndex index, DomModel* model);
ComboBoxDelegateBool* delegate_bool;
LineEditDelegate* delegate1;
ComboBoxDelegate* delegate2;
void setIcon();
void clearModel();
QByteArray HexStrToByte(QString value);
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent* event) override;
#endif // QT_NO_CONTEXTMENU
public slots:
void onItemAdded(const QModelIndex& index);
void treeView_expanded();
void treeView_collapsed();
void on_copyAction();
void on_cutAction();
void on_pasteAction();
void on_pasteAsChildAction();
void on_expandAction();
void on_collapseAction();
void on_actionNewSibling();
void on_actionNewChild();
void editorDataAboutToBeSet(const QModelIndex& index, QString val);
void treeView_clicked(const QModelIndex& index);
private slots:
void treeView_doubleClicked(const QModelIndex& index);
void slotCurrentRowChanged(const QModelIndex index,
const QModelIndex& previous);
void on_chkBox();
private:
QUndoStack* undoStack;
Ui::EditorTab* ui;
bool treeExpanded;
DomModel* model;
QFileInfo fileInfo;
QStandardItem* getTopParent(QStandardItem* item);
QModelIndex getTopParent(QModelIndex itemIndex);
QModelIndex index_bool_bak;
QString val_bool;
DomItem* item_bool;
QComboBox* comBox;
int hex_to_ascii(QString str);
};
#endif // EDITORTAB_H