Important: Please read the Qt Code of Conduct -

How to delete an already existing widget layout

  • I want to change QWidget layout

    delete layout;
    Ticker* pTicker = new Ticker(this);

    The program has unexpectedly finished.

  • Lifetime Qt Champion


    No, you are trying to modify/delete a QMainWindow layout which is not the same thing. Just don't try do that, QMainWindow's layout is a special layout to handle all its components (dock, status bar, tool bar etc.) . If you don't want it, just don't use a QMainWindow.

    If you still need a QMainWindow, your custom widget should go in as the central widget (with setCentralWidget) So you have to at least create a container widget like I wrote "here":

Log in to reply