rpcsx/rpcs3/rpcs3qt/flow_widget_item.h
Megamouse f115032095 Qt: implement flow layout game grid
This will allow us to properly style the grid and also remove the need to refresh the whole grid on a window resize
2023-05-06 06:31:58 +02:00

49 lines
925 B
C++

#pragma once
#include <QWidget>
#include <QKeyEvent>
#include <functional>
enum class flow_navigation
{
up,
down,
left,
right,
home,
end,
page_up,
page_down
};
class flow_widget_item : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool hover MEMBER m_hover) // Stylesheet workaround for descendants with parent pseudo state
Q_PROPERTY(bool selected MEMBER selected) // Stylesheet workaround for descendants with parent pseudo state
public:
using QWidget::QWidget;
virtual void polish_style();
void paintEvent(QPaintEvent* event) override;
void focusInEvent(QFocusEvent* event) override;
void focusOutEvent(QFocusEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
bool event(QEvent* event) override;
bool got_visible{};
bool selected{};
std::function<void()> cb_on_first_visibility{};
protected:
bool m_hover{};
Q_SIGNALS:
void navigate(flow_navigation value);
void focused();
};