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. QLayout: Attempting to add QLayout "" to browser"", which already has a layout
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.9k 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.
  • T Offline
    T Offline
    ThaRez
    wrote on last edited by
    #1

    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
    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        broadpeak
        wrote on last edited by
        #3

        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...

        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