2020-08-25 17:07:38 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2017 Kai Uwe Broulik <kde@privat.broulik.de>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-08-24 13:45:28 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "dolphin_export.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPointer>
|
|
|
|
|
|
|
|
class QAction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An event filter that allows to detect a middle click
|
|
|
|
* to trigger e.g. opening something in a new tab.
|
|
|
|
*/
|
|
|
|
class DOLPHIN_EXPORT MiddleClickActionEventFilter : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-02-03 21:21:30 +00:00
|
|
|
explicit MiddleClickActionEventFilter(QObject *parent);
|
2017-08-24 13:45:28 +00:00
|
|
|
~MiddleClickActionEventFilter() override;
|
|
|
|
|
2021-02-08 22:09:59 +00:00
|
|
|
Q_SIGNALS:
|
2017-08-24 13:45:28 +00:00
|
|
|
void actionMiddleClicked(QAction *action);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPointer<QAction> m_lastMiddlePressedAction;
|
|
|
|
};
|