#ifndef POPUP_H
#define POPUP_H

#include <QWidget>

class QLabel;
class QGridLayout;
class QPropertyAnimation;
class QTimer;

class PopUp : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(float popUpOpacity READ opacity WRITE setOpacity)

public:
    explicit PopUp(QWidget *parent = 0);
    void setOpacity(float opacity);
    float opacity() const;

protected:
    void paintEvent(QPaintEvent *event);

public slots:
    void setPopupText(const QString& text);
    void show();

private slots:
    void hideAnimation();
    void hide();

private:
    QLabel* mLabel{nullptr};
    QGridLayout* mLayout{nullptr};
    QPropertyAnimation* mAnimation{nullptr};
    QTimer *mTimer{nullptr};
    float mOpacity{0.5};
};

#endif // POPUP_H