From 6d445edb44a890fe9504080539a3fff7dbbbeb97 Mon Sep 17 00:00:00 2001 From: Patrick Flynn Date: Mon, 15 Oct 2018 20:21:21 +0200 Subject: [PATCH] Context menu for statusbar Summary: This adds a simple context menu to the statusbar; the only option it has is "Hide", which obviously hides the statusbar the same way as if you were to go the view menu. Reviewers: drosca Reviewed By: drosca Subscribers: drosca, falkon Tags: #falkon Differential Revision: https://phabricator.kde.org/D16158 --- src/lib/other/statusbar.cpp | 12 ++++++++++++ src/lib/other/statusbar.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/lib/other/statusbar.cpp b/src/lib/other/statusbar.cpp index 76f85806a..f2ff58cb3 100644 --- a/src/lib/other/statusbar.cpp +++ b/src/lib/other/statusbar.cpp @@ -32,6 +32,7 @@ #include #include #include +#include class StatusBarButton : public ClickableLabel { @@ -241,3 +242,14 @@ void StatusBar::removeButton(AbstractButtonInterface *button) delete m_widgets.take(button->id()).widget; } + +void StatusBar::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::RightButton) { + QMenu context; + context.addAction(tr("Hide"), m_window, &BrowserWindow::toggleShowStatusBar); + context.exec(QCursor::pos()); + } + + QStatusBar::mousePressEvent(event); +} diff --git a/src/lib/other/statusbar.h b/src/lib/other/statusbar.h index 68fad138b..ee24472ae 100644 --- a/src/lib/other/statusbar.h +++ b/src/lib/other/statusbar.h @@ -59,6 +59,9 @@ public: void addButton(AbstractButtonInterface *button); void removeButton(AbstractButtonInterface *button); +protected: + void mousePressEvent(QMouseEvent *event); + private: BrowserWindow *m_window; TipLabel *m_statusBarText;