From c245637c3892c691258d04153be3d5ae31f19c02 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 30 Nov 2023 20:46:37 +0100 Subject: [PATCH] Qt: force hover event handling for flow widget items Fixes hover movies for stylesheets that didn't have a game grid item style set for the hover state. --- rpcs3/rpcs3qt/flow_widget_item.cpp | 9 +++++++++ rpcs3/rpcs3qt/flow_widget_item.h | 3 ++- rpcs3/rpcs3qt/game_list_grid_item.cpp | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rpcs3/rpcs3qt/flow_widget_item.cpp b/rpcs3/rpcs3qt/flow_widget_item.cpp index cb1c607c42..8b766d3029 100644 --- a/rpcs3/rpcs3qt/flow_widget_item.cpp +++ b/rpcs3/rpcs3qt/flow_widget_item.cpp @@ -4,6 +4,15 @@ #include #include +flow_widget_item::flow_widget_item(QWidget* parent) : QWidget(parent) +{ + setAttribute(Qt::WA_Hover); // We need to enable the hover attribute to ensure that hover events are handled. +} + +flow_widget_item::~flow_widget_item() +{ +} + void flow_widget_item::polish_style() { style()->unpolish(this); diff --git a/rpcs3/rpcs3qt/flow_widget_item.h b/rpcs3/rpcs3qt/flow_widget_item.h index 28c7afe378..78e2d32426 100644 --- a/rpcs3/rpcs3qt/flow_widget_item.h +++ b/rpcs3/rpcs3qt/flow_widget_item.h @@ -25,7 +25,8 @@ class flow_widget_item : public QWidget Q_PROPERTY(bool selected MEMBER selected) // Stylesheet workaround for descendants with parent pseudo state public: - using QWidget::QWidget; + flow_widget_item(QWidget* parent); + virtual ~flow_widget_item(); virtual void polish_style(); diff --git a/rpcs3/rpcs3qt/game_list_grid_item.cpp b/rpcs3/rpcs3qt/game_list_grid_item.cpp index 9b369761e7..928a5fa264 100644 --- a/rpcs3/rpcs3qt/game_list_grid_item.cpp +++ b/rpcs3/rpcs3qt/game_list_grid_item.cpp @@ -7,6 +7,7 @@ game_list_grid_item::game_list_grid_item(QWidget* parent, game_info game, const : flow_widget_item(parent), movie_item_base(), m_game(std::move(game)) { setObjectName("game_list_grid_item"); + setAttribute(Qt::WA_Hover); // We need to enable the hover attribute to ensure that hover events are handled. cb_on_first_visibility = [this]() {