Qt World Summit: Register Today!

Qt - Resolve issues with QLayout: Attempting to add QLayout

  • When using a Custom Widget within a form I get the following error "QLayout: Attempting to add QLayout "" to RangeWidget "Area", which already has a layout" when I switched to Qt-4.8.4, but work fine with Qt-4.5.3(no warning messages)


    The custom-widget layout is as follows

    • QWidget
      • Area: QWidget
      • Limit: QWidget
        -Ranges - QGridLayout(2x2)

    There is no undefined behavior when running the application apart from the message that pops up on the terminal. Could members highlight why I get the QLayout messages having switched from Qt4.5.3 to Qt4.8.4?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    It means that you are trying to set a layout on a widget that already has a layout (so it fails). You must have something not clean in your code somewhere but you are lucky enough that it doesn't seem to have an impact.

    As for the why it did't on 4.5.3, I don't know, you would have to make a diff from these two versions.

    I would advise to recheck your code around this layout warning.

Log in to reply