]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphintabbar.h
GIT_SILENT Update Appstream for new release
[dolphin.git] / src / dolphintabbar.h
1 /*
2 * SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef DOLPHIN_TAB_BAR_H
8 #define DOLPHIN_TAB_BAR_H
9
10 #include <QTabBar>
11
12 class DolphinTabBar : public QTabBar
13 {
14 Q_OBJECT
15
16 public:
17 explicit DolphinTabBar(QWidget *parent);
18
19 Q_SIGNALS:
20 void openNewActivatedTab(int index);
21 void tabDragMoveEvent(int index, QDragMoveEvent *event);
22 void tabDropEvent(int index, QDropEvent *event);
23 void tabDetachRequested(int index);
24 void tabRenamed(int index, const QString &label);
25
26 protected:
27 void dragEnterEvent(QDragEnterEvent *event) override;
28 void dragLeaveEvent(QDragLeaveEvent *event) override;
29 void dragMoveEvent(QDragMoveEvent *event) override;
30 void dropEvent(QDropEvent *event) override;
31 void mousePressEvent(QMouseEvent *event) override;
32 void mouseReleaseEvent(QMouseEvent *event) override;
33 void mouseDoubleClickEvent(QMouseEvent *event) override;
34
35 /**
36 * Opens a context menu for the tab on the \a event position.
37 */
38 void contextMenuEvent(QContextMenuEvent *event) override;
39
40 private Q_SLOTS:
41 void slotAutoActivationTimeout();
42
43 private:
44 /**
45 * If \a index is a valid index (>= 0), store the index and start the timer
46 * (if the interval >= 0 ms). If the index is not valid (< 0), stop the timer.
47 */
48 void updateAutoActivationTimer(const int index);
49
50 private:
51 QTimer *m_autoActivationTimer;
52 int m_autoActivationIndex;
53 int m_tabToBeClosedOnMiddleMouseButtonRelease;
54 };
55
56 #endif // DOLPHIN_TAB_BAR_H