“Bending” a Qt Progress Bar

I have this code. Basically it slices the progressbar into colored pieces, depending on a specified folder’s size on a disk. But I want the prgress bar curved, so basically a circle, or maybe like a 300 degress, so a little “skipping” at the bottom. Don’t bother with the values 🙂
Any ideas how to do it? Thank you. I’m using Qt and c++

QString progressStyle = QString("::chunk {"
                                    "background-color: qlineargradient(x0:0, x2:1, "
                                    "stop: 0 green, stop: %1 green, "
                                    "stop: %2 #6495ED, stop: %3 #6495ED, "
                                    "stop: %4 red, stop: %5 red, "
                                    "stop: %6 orange, stop: %7 orange, "
                                    "stop: %8 transparent, stop: 1 transparent"")}")
                                .arg(QString::number(qMax(0.0001, images_percent)))
                                .arg(QString::number(qMax(0.0001, images_percent + 0.0001)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent + 0.0001)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent + downloads_percent)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent + downloads_percent + 0.0001)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent + downloads_percent + others_percent)))
                                .arg(QString::number(qMax(0.0001, images_percent + docs_percent + downloads_percent + others_percent + 0.0001)));
    ui->bar->setStyleSheet(progressStyle);

I have this code so far

enter image description here

I want it like that, but with solid separated colors, just like how it does now:
enter image description here
Some folders are empty, so it shows only 2 colors right now.

Leave a Comment