QString style_0_60 = "QProgressBar::chunk{ background-color: green; }";QString style_60_80 = "QProgressBar::chunk{ background-color: orange; }";QString style_80_100 = "QProgressBar::chunk{ background-color: red; }"; #include class MyProgressBar : public QProgressBar{public: MyProgressBar(); void setValue(int value);}; void MyProgressBar::setValue(int value){ if(value >= 0 && value < 60) this->setStyleSheet(style_0_60); else if (value >= 60 && value < 80) this->setStyleSheet(style_60_80); else this->setStyleSheet(style_80_100); QProgressBar::setValue(value);}