Yet another approach would be to set the alignment of the status text through QProgressBar::setAlignment
:
barProgress_->setAlignment(Qt::AlignCenter);
Domanda
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:
Soluzione
Yet another approach would be to set the alignment of the status text through QProgressBar::setAlignment
:
barProgress_->setAlignment(Qt::AlignCenter);
Altri suggerimenti
You can use stylesheets to modify the look of the progress bar. Here's an example: http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qprogressbar
Thanks to vipw's suggestion above I have achieved the effect I'm looking for with a simple call to setStyleSheet() as follows (there is no spreadsheet currently defined for this app and it's practically finished so the call to this method will save me having to include an entire new css file):
barProgress_->setStyleSheet(QString::fromUtf8("text-align: center;"));
The result is:
Anyway thanks for the help.