#ifndef PROGRESS_H
#define PROGRESS_H

#include <QWidget>
#include <QIcon>
#include <QLabel>
#include <QEvent>
#include <QToolTip>
#include <QHelpEvent>

namespace Ui {
class Progress;
}

class MyTooltipLabel : public QLabel{
    Q_OBJECT
public:
    MyTooltipLabel(QWidget* parent = nullptr) : QLabel(parent){

    }
    bool event(QEvent *e) override {
        if(e->type() == QEvent::Enter){
            QToolTip::showText(QCursor::pos(), this->toolTip(), this, QRect(),toolTipDuration());
        }else if(e->type() == QEvent::Leave){
            QToolTip::hideText();
        }
        return QLabel::event(e);
    }
};

class Progress : public QWidget
{
    Q_OBJECT
Q_SIGNALS:
    void setRange(int, int);
    void setValue(int, QIcon, QString);
    void addValue(int, QIcon, QString);
    void title(QString);
public:
    explicit Progress(QWidget *parent = nullptr);
    ~Progress();

public slots:
     void slotChangeUIFontSize(int fontSize);
     void resetProgressBar();

private slots:
    void setsSetRange(int, int);
    void slotsSetValue(int, QIcon icon = QIcon(), QString str = QString());
    void slotsAddValue(int, QIcon icon = QIcon(), QString str = QString());

private:
    Ui::Progress *ui;
    int m_RangeBegin;
    int m_RangeEnd;
    int m_currnet;
};

#endif // PROGRESS_H
