#ifndef ProgressBar_H #define ProgressBar_H #include #include "../Global.h" struct Tick{ QString mText; QColor mColor; double mValue = 0; Tick(QString text, QColor color) : mText(std::move(text)), mColor(std::move(color)){ QString that = (mText[0] == '+' || mText[0] == '-' || mText[0] == '<' || mText[0] == '>') ? mText.mid(1) : mText; mValue = that.toDouble(); } Tick(QString text, QColor color, double value) : mText(std::move(text)), mColor(std::move(color)){ mValue = value; } }; class ProgressBar : public QWidget { public: explicit ProgressBar(const QVector& tickList, QWidget *parent = nullptr); double mTickSpaceW = 1; double mValue = 0; int mTimer; std::function mSetValue = nullptr; double getDrawWidth(double value); protected: void paintEvent(QPaintEvent *event) override; void timerEvent(QTimerEvent *event) override; QVector mTickList; }; #endif