QStyleOptionProgressBarV2 adding stylesheet , how can it be done ?



  • I have ListWidgetItem Deleget , in the paint method i drow progress bar like this :

    @ QStyleOptionProgressBarV2 optionProgress;

            optionProgress.rect = ProgressBarRec;
            optionProgress.maximum = 100;
            optionProgress.minimum = 0;
            optionProgress.progress = 0;
            optionProgress.textVisible = false;
            optionProgress.orientation = Qt::Horizontal;
            QApplication::style()->drawControl(QStyle::CE_ProgressBar, &optionProgress, painter, 0);   
    

    @

    all working great and i see the progressBar , but now i want to style it , and i can't find any way to do it ,
    how do i style QStyleOptionProgressBarV2
    with this :

    @ QProgressBar:horizontal {
    border: 1px solid gray;
    border-radius: 3px;
    background: white;
    padding: 1px;
    }
    QProgressBar::chunk:horizontal {
    background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.