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. Form compiler adds unneeded layout

Form compiler adds unneeded layout

Scheduled Pinned Locked Moved General and Desktop
widgetslayoutforms
3 Posts 2 Posters 1.4k 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.
  • kshegunovK Offline
    kshegunovK Offline
    kshegunov
    Moderators
    wrote on last edited by
    #1

    Hello,
    I have a custom widget with a form attached to it. The form has a layout and is set up properly. I have set the aforementioned widget to be a central widget for a QMainWindow. The problem is that (I suppose) because QMainWindow has a form itself, the resource compiler generates a layout which it tries to attach to my central widget. Now my central widget already has a layout, so Qt is complaining: "QLayout: Attempting to add QLayout "" to ... "centralWidget", which already has a layout".
    What is the proper way to resolve this? I could of course use a generic widget to be a container for my custom one, but I see no good reason to breed widgets unnecessarily ...

    Kind regards.

    Read and abide by the Qt Code of Conduct

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi and welcome
      well normally adding a placeholder widget is the way to to do it.
      QMainWindow is a bit special with docking etc.

      1 Reply Last reply
      1
      • kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #3

        Hello,
        Thanks for taking the time to welcome me into the forums and write about my question. I will then make a placeholder widget, as you suggested, and take it from there.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        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