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. Top level layout breaks desired form layout
QtWS25 Last Chance

Top level layout breaks desired form layout

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 10.4k Views
  • 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.
  • D Offline
    D Offline
    djsuson
    wrote on last edited by
    #1

    I am having a strange problem. I'm trying to set up a dialog box using Qt 4.8 similar to one that I created under Qt 3. I'm using Qt Designer to set up the form. I get everything laid out, so that it looks like this:

    !https://dl.dropboxusercontent.com/u/40246252/DialogBox-Before.jpg(Dialog box before adding top level layout)!

    If I try to save the form at this point I get the error message

    This file contains top level spacers.
    They have NOT been saved into the form.

    Perhaps you forgot to create a layout?

    In order to avoid this message plus make sure the form resizes properly, I tried setting up a vertical layout at the top level. When I do this the form gets changed to look like this:

    !https://dl.dropboxusercontent.com/u/40246252/DialogBox-After.jpg(Dialog box after applying top level layout)!

    Notice that not only are the various regions sized incorrectly, but the critical box, where the type of data set and the details associated with it, is no longer visible. It is behind the enlarged button bar. If I try to save this version I get the same error message as before, so something is going wrong in that regard as well. The ui file puts me over the posting limit, but I can mail it (or try to post only it) upon request.

    What am I doing wrong and how do I get the form to look the way I want it to? I was able to make this form before, but am obviously not understanding something in the transition from Qt 3 to Qt 4. I need to solve this before making the additional 15 forms associated with the program!

    Thank you,
    Dan Suson

    1 Reply Last reply
    0
    • D Offline
      D Offline
      djsuson
      wrote on last edited by
      #2

      I was able to fix this by creating a QWidget object that is the same size as the basic form and then putting all of my objects inside that widget. I'm not sure I understand why this is necessary, but it seems to work.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andisugandi
        wrote on last edited by
        #3

        Hi djsuson,

        How to do the "creating a QWidget object" exactly? Is doing that in Qt Designer?

        Thanks in advance.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andisugandi
          wrote on last edited by
          #4

          Hi djsuson,

          How to do the "creating a QWidget object" exactly? Is doing that in Qt Designer?

          Thanks in advance.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            buddhog
            wrote on last edited by
            #5

            This happened to me and I had one spacer not joined in a layout with any other object. I just did a layout using it and the problem solved.

            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