Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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);
    QMainWindow::setCentralWidget(pTicker);

    The program has unexpectedly finished.


  • Lifetime Qt Champion

    Hi,

    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":http://qt-project.org/forums/viewthread/49120/P15/


Log in to reply