From 167257fa2fc99696abe2e9c78f1373f332297577 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sun, 20 Mar 2022 01:12:26 +0100 Subject: [PATCH] Remove "hover" flag in top bar widgets It was used for a tiny graphical tweak of little importance. See #940. --- client/gui-qt/top_bar.cpp | 40 ++------------------------------------- client/gui-qt/top_bar.h | 4 ---- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/client/gui-qt/top_bar.cpp b/client/gui-qt/top_bar.cpp index afbd692087..045ba288de 100644 --- a/client/gui-qt/top_bar.cpp +++ b/client/gui-qt/top_bar.cpp @@ -60,8 +60,8 @@ void reduce_mod(int &mod, int &val) top_bar_widget::top_bar_widget(const QString &label, const QString &pg, pfcn_bool func, standards type) : QToolButton(), blink(false), keep_blinking(false), standard(type), - page(pg), hover(false), right_click(nullptr), wheel_down(nullptr), - wheel_up(nullptr), left_click(func) + page(pg), right_click(nullptr), wheel_down(nullptr), wheel_up(nullptr), + left_click(func) { setText(label); setToolButtonStyle(Qt::ToolButtonTextBesideIcon); @@ -190,42 +190,6 @@ void top_bar_widget::paintEvent(QPaintEvent *event) QToolButton::paintEvent(event); } -/** - Mouse entered on widget area - */ -void top_bar_widget::enterEvent(QEvent *event) -{ - if (!hover) { - hover = true; - QWidget::enterEvent(event); - update(); - } -} - -/** - Mouse left widget area - */ -void top_bar_widget::leaveEvent(QEvent *event) -{ - if (hover) { - hover = false; - QWidget::leaveEvent(event); - update(); - } -} - -/** - Context menu requested - */ -void top_bar_widget::contextMenuEvent(QContextMenuEvent *event) -{ - if (hover) { - hover = false; - QWidget::contextMenuEvent(event); - update(); - } -} - /** Sets callback for mouse left click */ diff --git a/client/gui-qt/top_bar.h b/client/gui-qt/top_bar.h index 27a976501b..672201a823 100644 --- a/client/gui-qt/top_bar.h +++ b/client/gui-qt/top_bar.h @@ -62,15 +62,11 @@ public slots: void someSlot(); protected: - void contextMenuEvent(QContextMenuEvent *event) override; - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void paintEvent(QPaintEvent *event) override; void wheelEvent(QWheelEvent *event) override; private: - bool hover; pfcn right_click; pfcn wheel_down; pfcn wheel_up;