Alignment of the qt state center?

How to center text alignment in QStatusBar? By default, it always aligns to the left.

I know that I can add QLabel and set the alignment, but I want to use plain text and the .showMessage (QString, int) method, so I can add a timeout value.

+3
source share
2 answers

A QStatusBar has three functions here:

addPermanentWidget - Puts an alignable widget

addWidget - places the widget on the left aligned, which can be hidden by status messages

showMessage - displays a status message

. , , , . , QLabel addPermanentWidget?

: http://doc.qt.io/qt-5/qstatusbar.html

+4

Bar, :

QLabel* statusLabel = new QLabel("Your Message");
statusBar()->addWidget(statusLabel,1);

1 .

+4

Source: https://habr.com/ru/post/1779498/


All Articles