QT学习 QProgressBar颜色设置

以下内容转载自诺基亚官方网站:http://doc.qt.nokia.com/latest/stylesheet-examples.html#customizing-qprogressbar

 

Customizing QProgressBar

The QProgressBar's border, chunk, and text-align can be customized using style sheets. However, if one property or sub-control is customized, all the other properties or sub-controls must be customized as well.

                                                 

For example, we change the border to grey and the chunk to cerulean.

 QProgressBar {
     border: 2px solid grey;
     border-radius: 5px;
 }

 QProgressBar::chunk {
     background-color: #05B8CC;
     width: 20px;
 }

This leaves the text-align, which we customize by positioning the text in the center of the progress bar.

 QProgressBar {
     border: 2px solid grey;
     border-radius: 5px;
     text-align: center;
 }A margin can be included to obtain more visible chunks.

 

In the screenshot above, we use a margin of 0.5 pixels.

 QProgressBar::chunk {
     background-color: #CD96CD;
     width: 10px;
     margin: 0.5px;
 }


你可能感兴趣的:(properties,qt,border)