PDA

View Full Version : QProgressBar with custom text



smoon
5th March 2011, 22:13
Hi,

how can I use custom text on a QProgressBar?

d_stranz
5th March 2011, 23:38
Looks to me like you will have to derive your own widget from QProgressBar and override paintEvent() so it will draw your text. Wouldn't it be easier just to put a QLabel next to the standard progress bar and connect to the progress bar's valueChanged() signal so you can change the text on the label?

bmn
10th May 2012, 15:44
To write a custom text into a progress bar you can use the format string. If you write in some text instead of %p% for percentage the text will be displayed.

see format() or setFormat().