@Saviz
#include <QApplication>
#include <QMouseEvent>
#include <QVideoWidget>
class HoverVideoWidget : public QVideoWidget
{
public:
HoverVideoWidget(QWidget *parent = nullptr) : QVideoWidget(parent)
{
setMouseTracking(true); // Enable mouse tracking to get hover events
}
protected:
void enterEvent(QEvent *event) override
{
// Called when the mouse enters the widget
setStyleSheet("background-color: lightblue;"); // Set the background color to light blue
}
void leaveEvent(QEvent *event) override
{
// Called when the mouse leaves the widget
setStyleSheet(""); // Reset the background color to default
}
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
HoverVideoWidget player;
player.show();
return app.exec();
}