Search code examples
qttoolbarstatusbar

How to remove bar from QMainWindow


I'm trying to delete this bar, butI can't get rid of it (it's locate just under the toolbar):

enter image description here

What is the name of that bar,how can I access it? Thank you.


Solution

  • If you added that tool bar you probably have a pointer to it? If yes, you can simply call:

    removeToolBar(toolbar);
    

    in your QMainWindow class. Otherwise you can remove all tool bars from the main window as:

    QList<QToolBar *> allToolBars = mainWindow->findChildren<QToolBar *>();
    foreach(QToolBar *tb, allToolBars) {
        // This does not delete the tool bar.
        mainWindow->removeToolBar(tb);
    }