#include "menuentry.h"
#include <QApplication>
#include <QTimer>

MenuEntry::MenuEntry(QWidget* parent, Qt::WindowFlags)
    : QLabel(parent) {

    connect(this, &MenuEntry::clicked, this, &MenuEntry::on_clicked);
}

MenuEntry::~MenuEntry() {}

void MenuEntry::mousePressEvent(QMouseEvent* event) {
    event->ignore();
    emit entryIsPressed(this);
    emit clicked();
}

void MenuEntry::mouseMoveEvent(QMouseEvent *event)
{
    event->ignore();
    emit entryIsHovered(this);
}

void MenuEntry::on_clicked()
{
    setStyleSheet(active_stylesheet);
    QTimer::singleShot(200, [this](){
        setStyleSheet(default_stylesheet);
    });
}
