Qt QProgressBar - aligning text

kh25 picture kh25 · Feb 21, 2013 · Viewed 7.2k times · Source

Has anyone any suggestions on how to align the status text on the QProgressBar in Qt? By default in Windows it appears to the right of the bar but I'd prefer to place it either above the bar or within the bar itself without having to extend the object and implement a status label myself.

Screenshot below:

enter image description here

Answer

Andreas Fester picture Andreas Fester · Feb 22, 2013

Yet another approach would be to set the alignment of the status text through QProgressBar::setAlignment:

barProgress_->setAlignment(Qt::AlignCenter);

Progress bar screen shot