2020-08-25 17:07:38 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2014 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2014-07-08 17:38:18 +00:00
|
|
|
|
|
|
|
#ifndef DOLPHIN_TAB_BAR_H
|
|
|
|
#define DOLPHIN_TAB_BAR_H
|
|
|
|
|
|
|
|
#include <QTabBar>
|
|
|
|
|
|
|
|
class DolphinTabBar : public QTabBar
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-02-03 17:14:53 +00:00
|
|
|
explicit DolphinTabBar(QWidget *parent);
|
2014-07-08 17:38:18 +00:00
|
|
|
|
2021-02-08 22:09:59 +00:00
|
|
|
Q_SIGNALS:
|
2014-07-08 17:38:18 +00:00
|
|
|
void openNewActivatedTab(int index);
|
2023-02-03 17:14:53 +00:00
|
|
|
void tabDropEvent(int index, QDropEvent *event);
|
2014-07-08 17:38:18 +00:00
|
|
|
void tabDetachRequested(int index);
|
|
|
|
|
|
|
|
protected:
|
2023-02-03 17:14:53 +00:00
|
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
|
|
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
|
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2014-07-08 17:38:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens a context menu for the tab on the \a event position.
|
|
|
|
*/
|
2023-02-03 17:14:53 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
2014-07-08 17:38:18 +00:00
|
|
|
|
2021-02-08 22:09:59 +00:00
|
|
|
private Q_SLOTS:
|
2014-07-08 17:38:18 +00:00
|
|
|
void slotAutoActivationTimeout();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* If \a index is a valid index (>= 0), store the index and start the timer
|
|
|
|
* (if the interval >= 0 ms). If the index is not valid (< 0), stop the timer.
|
|
|
|
*/
|
|
|
|
void updateAutoActivationTimer(const int index);
|
|
|
|
|
|
|
|
private:
|
2023-02-03 17:14:53 +00:00
|
|
|
QTimer *m_autoActivationTimer;
|
2014-07-08 17:38:18 +00:00
|
|
|
int m_autoActivationIndex;
|
2017-02-13 12:20:07 +00:00
|
|
|
int m_tabToBeClosedOnMiddleMouseButtonRelease;
|
2014-07-08 17:38:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DOLPHIN_TAB_BAR_H
|