0
votes

I want to add a QLabel to a QMenuBar. I was able to add a QLabel to a QMenu using QActionWidget, but I want the QLabel to sit on the QMenuBar (as a substitute for a QMenu) at the right end of my application. I intend to add a movie to this QLabel in order to simulate a loading circle to indicate that the application is running. How can I add a QWidget to a QMenuBar, or is there some alternative to my ultimate goal? I am using Qt 5.6 with Qt Designer

1
This isn't portable, so it's best avoided. It'll look out of place on pretty much every environment Qt runs in.Kuba hasn't forgotten Monica
Does the QLabel absolutely have to be part of the QMenuBar? If not then why not add the QMenuBar and QLabel to the same QHBoxLayout with a 'stretch' in between. Or perhaps I'm missing something.G.M.
No the QLabel does not have to be a part of the QMenuBar. I would like to have it in the upper right corner of my application at all times. I can't seem to add the QMenuBar and QLabel to a QHBoxLayout. Is it even possible? I'm doing it in Qt Designer rather than programmaticallyDillydill123

1 Answers

2
votes

A widget can be added to the end of the menu-bar with QMenuBar::setCornerWidget.