-
Notifications
You must be signed in to change notification settings - Fork 41
/
editortabswidget.h
46 lines (36 loc) · 1.04 KB
/
editortabswidget.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
#ifndef EDITORTABSWIDGET_H
#define EDITORTABSWIDGET_H
#include <QContextMenuEvent>
#include <QMainWindow>
#include <QMenu>
#include <QSortFilterProxyModel>
#include "editortab.h"
class EditorTabsWidget : public QTabWidget {
Q_OBJECT
public:
EditorTabsWidget(QWidget* parent = 0);
~EditorTabsWidget();
EditorTab* createTab(DomModel* model, QString filePath = "");
EditorTab* getCurentTab();
EditorTab* getTab(int i = -1);
bool hasTabs();
void contextMenuEvent(QContextMenuEvent* event) override;
protected:
public slots:
void closeTab(int i = -1);
void closeTabsToRight();
void closeOtherTabs();
void closeAllTabs();
signals:
void tabCloseRequested(int i);
private:
void createMenu();
void initTabBar();
void popPage(QWidget* page);
void takeNormalPage(QWidget* page);
int appendNormalPage(QWidget* page);
bool indexValid(int index) const;
//保存不能拖出、没有关闭按钮的tab页(如主页)
QList<QWidget*> fixedPage;
};
#endif // EDITORTABSWIDGET_H