How to hide the status bar Qt

Solution 1:

QMainWindow::setStatusBar(nullptr);

You can also use 'this' instead of 'ui'

this->statusbar()->hide();

Alternative: this->statusbar()->setVisible(false);

Ui is the form itself, 'this' is the MainWindow widget. Statusbar() is a member of MainWindow, not the Ui form. You cannot access ui->MainWindow directly, In class MainWindow, access its members with 'this->'.

Solution 2:

I tried to use statusbar()->hide() from code, and that didn't solve my specific problem which was that the real estate for the statusbar still existed on the dialog, and also in the UI Designer.

My solution: Manually edit the myview.ui file and remove the line:

<widget class="QStatusBar" name="statusbar"/>

That solved it: no more status bar. (since I didn't want it there, this worked for me)