QLabel embedding in QStatusBar using Qt Designer

Mohammad Sheykholeslam picture Mohammad Sheykholeslam · Apr 26, 2010 · Viewed 16.6k times · Source

Is there any solution to embed a QLabel in QStatusBar using Qt Designer?

Answer

Kitsune picture Kitsune · Apr 30, 2010

I don't believe so. It's fairly simple to add one programmatically, though.

If you're just wanting to show a message, you could use: statusBar()->showMessage(tr("Message Here"));, or alternatively if you really needed a QLabel on the status bar, you could do something along the lines of:

QLabel *label = new QLabel("Message");
statusBar()->addWidget(label);

label would become a child of statusBar(), and appear in the first empty spot from the bottom left (addPermanentWidget(label) would add it to the first empty spot from the bottom right). If you place QLabel label in the classes header (or other var name), you'd be able to access the variable directly later (removing the initial QLabel type from the first line, of course).