QLayout: Attempting to add QLayout "" to browser"", which already has a layout



  • Hello
    I'm a bit confused with the Widget/Layout relationship. I have a widget (A) that has a QHBoxLayout. To this I want to add a custom widget (B) that has a gridlayout of its own. And finally add some custom widget (C) to this grid. How should this be done correctly?

    I add B->A with addwidget (on the layout). In Bs constructor (the custom one) I've called QWidget(parent) to init the superclass. I've also added a layout whose parent I've set to "this".

    Finally I've added the custom widgets to this grid. But I get a bunch of:

    @QLayout: Attempting to add QLayout "" to XXX"", which already has a layout@

    I guess there's epic fail in this principle, but can't figure out what. Could someone please help.

    • R


  • Could you please post some code instead of this dark explanation :D ?



  • If you don't want to reordering your widget and layout you can use this:
    delete yourWidget->layout;
    But your problem basicly is the wrong layout assigning with widgets.

    Anyway a codesnippet would be useful...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.