Form compiler adds unneeded layout


  • Qt Champions 2017

    Hello,
    I have a custom widget with a form attached to it. The form has a layout and is set up properly. I have set the aforementioned widget to be a central widget for a QMainWindow. The problem is that (I suppose) because QMainWindow has a form itself, the resource compiler generates a layout which it tries to attach to my central widget. Now my central widget already has a layout, so Qt is complaining: "QLayout: Attempting to add QLayout "" to ... "centralWidget", which already has a layout".
    What is the proper way to resolve this? I could of course use a generic widget to be a container for my custom one, but I see no good reason to breed widgets unnecessarily ...

    Kind regards.


  • Lifetime Qt Champion

    hi and welcome
    well normally adding a placeholder widget is the way to to do it.
    QMainWindow is a bit special with docking etc.


  • Qt Champions 2017

    Hello,
    Thanks for taking the time to welcome me into the forums and write about my question. I will then make a placeholder widget, as you suggested, and take it from there.

    Kind regards.