Attempting to set QLayout "layout1" on QFrame "frame1", when the QLayout already has a parent



  • I'm getting the above error upon

    @
    frame1->setLayout(layout1);
    @

    Do I need to unparent layout1, make it an orphan? How?
    Thanks.

    /*
    I could not find a reference or discussion on this.
    There's enough reference and discussion on the similar issue of when the widget (frame1) already has a layout.
    That's not the case here.
    "frame1" is empty, has no children, no layout.
    The problem here is that "layout1" is already set onto some other widget (parent?)
    */



  • This warning is given if the parent of that layout is not a widget.

    Reparenting with setParent might work:
    @layout1->setParent(0);
    frame1->setLayout(layout1);@


Log in to reply
 

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