Important: Please read the Qt Code of Conduct -

QMdiSubWindow Not Obeying Child Size.

  • @SheetEditor::SheetEditor()
    statSheet = new StatSheet( this );

    const int x = 1;
    const int y = 1;
    statSheet->move( x, y );
    resize( statSheet->size() );


    void MainWindow::newSheetAction()
    SheetEditor *se = new SheetEditor;
    mdiArea->addSubWindow( se );

    I have a QWidget, SheetEditor, that has a child widget, statSheet. I resize SheetEditor to match the size of its child widget. The sheet editor becomes added as a subwindow (which gets set as the internal widget of a QMdiSubWindow). The subwindow does not obey the size of the child widgets. It is always 125 in width and 0 in height, which is just enough to show only the application icon, min, max, and close buttons.

    What is the proper way to get the QMdiSubWindow size to fit the contents of its children?

Log in to reply