How can I center align the text in QStatusBar? By default it is always left aligned.
I know I can add a QLabel and set alignment, but I want to use plain text, and .showMessage(QString, int) method, so I can add the timeout value.
A QStatusBar has three functions of note here:
addPermanentWidget
- Places a widget right aligned
addWidget
- Places a widget left aligned which can be obscured by status messages
showMessage
- Displays a status message
These are well established standards for status bars. While you could hack away to get what you're looking for, I'd suggest you reconsider your needs. Perhaps your QLabel should be placed with addPermanentWidget instead?
Take a look at the docs for more info: http://doc.qt.io/qt-5/qstatusbar.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With