Changeset View
Changeset View
Standalone View
Standalone View
src/DetachableTabBar.h
Show All 17 Lines | |||||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef DETACHABLETABBAR_H | 20 | #ifndef DETACHABLETABBAR_H | ||
21 | #define DETACHABLETABBAR_H | 21 | #define DETACHABLETABBAR_H | ||
22 | 22 | | |||
23 | #include <QTabBar> | 23 | #include <QTabBar> | ||
24 | #include <QCursor> | 24 | #include <QCursor> | ||
25 | 25 | | |||
26 | namespace Konsole { | ||||
27 | class TabbedViewContainer; | ||||
26 | class DetachableTabBar : public QTabBar { | 28 | class DetachableTabBar : public QTabBar { | ||
27 | Q_OBJECT | 29 | Q_OBJECT | ||
28 | public: | 30 | public: | ||
31 | enum class DragType : unsigned char {NONE, OUTSIDE, WINDOW}; | ||||
32 | | ||||
29 | explicit DetachableTabBar(QWidget *parent = nullptr); | 33 | explicit DetachableTabBar(QWidget *parent = nullptr); | ||
30 | Q_SIGNALS: | 34 | Q_SIGNALS: | ||
31 | void detachTab(int idx); | 35 | void detachTab(int index); | ||
36 | void moveTabToWindow(int tabIndex, QWidget *otherWindow); | ||||
32 | protected: | 37 | protected: | ||
38 | void mousePressEvent(QMouseEvent *event) override; | ||||
33 | void mouseMoveEvent(QMouseEvent*event) override; | 39 | void mouseMoveEvent(QMouseEvent*event) override; | ||
34 | void mouseReleaseEvent(QMouseEvent *event) override; | 40 | void mouseReleaseEvent(QMouseEvent *event) override; | ||
41 | bool droppedContainerIsNotThis(const QPoint& currentPos) const; | ||||
42 | | ||||
35 | private: | 43 | private: | ||
36 | bool _draggingOutside; | 44 | DragType dragType; | ||
37 | QCursor _originalCursor; | 45 | QCursor _originalCursor; | ||
46 | QList<TabbedViewContainer*> _containers; | ||||
38 | }; | 47 | }; | ||
48 | } | ||||
39 | 49 | | |||
40 | #endif | 50 | #endif |