0
votes

I'm painting a QProgressBar (using QStyleOptionProgressBar) into a QabstractTableModel ,the code just like this http://qt-project.org/doc/qt-4.8/qabstractitemdelegate.html

now I want to set its style sheet similar to this

('QProgressBar::chunk {background-color: rgb(102, 204, 255);} QProgressBar {border: 2px solid rgb(0, 128, 255); border-radius: 5px; background-color: rgb(200, 200, 200);}')

so what syntax should I use ?

1

1 Answers

0
votes

Every QWidget has 'setStyleSheet':

yourWidget.setStyleSheet('your stylesheet string')

Please note that the stylesheet string you mentioned already contains 'selectors', so if you set that string to a parent widget, the child will inherit it will only show on the selected objects (like CSS) - (in practice every 'QProgressBar' inside a window (for example) will have that style, because they will inherit it and are selected on it). Best Regards.