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.
This commit is contained in:
Megamouse 2023-11-30 20:46:37 +01:00
parent 4a4f537ee8
commit c245637c38
3 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,15 @@
#include <QStyleOption>
#include <QPainter>
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);

View File

@ -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();

View File

@ -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]()
{