Skip to content

Commit

Permalink
Remove "hover" flag in top bar widgets
Browse files Browse the repository at this point in the history
It was used for a tiny graphical tweak of little importance.

See longturn#940.
  • Loading branch information
lmoureaux committed Mar 25, 2022
1 parent da19d19 commit 167257f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
40 changes: 2 additions & 38 deletions client/gui-qt/top_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
*/
Expand Down
4 changes: 0 additions & 4 deletions client/gui-qt/top_bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 167257f

Please sign in to comment.