Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Attempting to set QLayout "layout1" on QFrame "frame1", when the QLayout already has a parent

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marius63
    wrote on last edited by
    #1

    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?)
    */

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexisdm
      wrote on last edited by
      #2

      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);@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved