How to add second status bar and display it above the first one?
-
This TEST (!) code is an attempt to add second status bar to QMainWindow.
I cannot figure out how to locate / display it.
I like to have it ABOVE the current , default, status bar.Do I have to calculate the size of current, default bar and then set the second one accordingly ? (yes/ no answer would be sufficient)
Will such calculation " make room" in the layout so BOTH status bars can be shown SAME TIME ?
Do I have to "resize" the main part of the layout?
PS
when I use
statusBar()->addWidget(secondstatusbar);the second bar takes place of the original bar.
That MAY work , but not what I need.m_ui->setupUi(this); // add secondstatusbar here ?? //Add QStatusBar *secondstatusbar = new QStatusBar(this); this->layout()->addWidget(secondstatusbar); text = " A TEST secondstatusbar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ; secondstatusbar->showMessage(text); secondstatusbar->setBaseSize(4000,4000); secondstatusbar->move(0,600); statusBar()->addWidget(secondstatusbar);
-
@AnneRanch
The only obvious mistake is the last linestatusBar()->addWidget(secondstatusbar);
Since you show only parts of your code, we don't know whatthis
is. If it inherits fromQMainWindow
, don't add the second status bar to the main window layout. Add a layout to your central widget, add a horizontal spacer to push your 2nd status bar to the bottom. It doesn't make much sense to callmove()
on a widget in a layout.I am sure you have read everything about status bars, layouts and main windows.
-
@Axel-Spoerl How dare you to mention layouts here? It's forbidden: https://forum.qt.io/topic/155559/another-reuse-question !
-
@Christian-Ehrlicher
Shame on me. -