How can I put my QGridLayout in a window that inherits from QMdiSubWindow ? Attempting a simple setLayout() produces a Vorning, saying that the window already has its layout.

UPD: By trial and error, I came up with creating a QFrame instance and putting it with the setWidget() method as an internal window widget, and already clinging to this frame is a layout. Is this the right approach?

    1 answer 1

    You can either use the existing layout, or insert the most ordinary empty widget (expanding horizontally and vertically) via setWidget into this setWidget and insert your QGridLayout into this widget.

    • And how to use the existing one? Here I will need to arrange a dozen elements on the grid. - Artik
    • one
      @Artik, you really don't need to use the existing layer, since It is designed to accommodate the toolbar, the menu and, in fact, the most inserted widget. Otherwise, @Matty is right: the setWidget() method should be enabled, in which we insert an empty QWidget , and in turn, we hang a grid layer on it - QGridLayout . - alexis031182
    • Thanks for the help! - Artik