1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Plugins: Hook key events in TabWidget

This commit is contained in:
David Rosca 2018-02-04 10:11:38 +01:00
parent 25d70e557a
commit 0bf881c168
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 23 additions and 0 deletions

View File

@ -89,6 +89,7 @@ enum CommandLineAction {
enum ObjectName {
ON_WebView,
ON_TabBar,
ON_TabWidget,
ON_BrowserWindow
};

View File

@ -30,6 +30,7 @@
#include "qzsettings.h"
#include "qztools.h"
#include "tabicon.h"
#include "pluginproxy.h"
#include <QFile>
#include <QTimer>
@ -196,6 +197,24 @@ void TabWidget::updateClosedTabsButton()
m_buttonClosedTabs->setVisible(m_showClosedTabsButton && canRestoreTab());
}
void TabWidget::keyPressEvent(QKeyEvent *event)
{
if (mApp->plugins()->processKeyPress(Qz::ON_TabWidget, this, event)) {
return;
}
TabStackedWidget::keyPressEvent(event);
}
void TabWidget::keyReleaseEvent(QKeyEvent *event)
{
if (mApp->plugins()->processKeyRelease(Qz::ON_TabWidget, this, event)) {
return;
}
TabStackedWidget::keyReleaseEvent(event);
}
bool TabWidget::isCurrentTabFresh() const
{
return m_currentTabFresh;

View File

@ -151,6 +151,9 @@ private:
bool validIndex(int index) const;
void updateClosedTabsButton();
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
BrowserWindow* m_window;
TabBar* m_tabBar;
QStackedWidget* m_locationBars;