1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef TEXTEDITSPLITTER_H |
6 | #define TEXTEDITSPLITTER_H |
7 | |
8 | #include "textedittabwidget.h" |
9 | |
10 | #include <QObject> |
11 | #include <QGridLayout> |
12 | #include <QSplitter> |
13 | #include <QList> |
14 | #include <QPair> |
15 | |
16 | class TextEditSplitter : public QWidget |
17 | { |
18 | Q_OBJECT |
19 | public: |
20 | friend class TextEditTabWidget; |
21 | |
22 | explicit TextEditSplitter(QWidget *parent = nullptr); |
23 | QSplitter *getSplitter() const; |
24 | |
25 | public slots: |
26 | void doSplit(Qt::Orientation orientation, const newlsp::ProjectKey &key, const QString &file); |
27 | void doClose(); |
28 | void doSelected(bool state); |
29 | void doShowSplit(); |
30 | static TextEditSplitter *instance(); |
31 | |
32 | private: |
33 | virtual ~TextEditSplitter() override; |
34 | void updateClose(QSplitter *splitter, TextEditTabWidget *textEditTabWidget); |
35 | QVBoxLayout *vLayout = nullptr; |
36 | QSplitter *mainSplitter = nullptr; |
37 | TextEditTabWidget *tabWidget = nullptr; |
38 | QHash<TextEditTabWidget *, bool> tabWidgets; |
39 | QHash<QSplitter *, QPair<TextEditTabWidget *, TextEditTabWidget*>> splitters; |
40 | }; |
41 | |
42 | #endif // TEXTEDITSPLITTER_H |
43 |