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. Layout margins?
Qt 6.11 is out! See what's new in the release blog

Layout margins?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.8k 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.
  • S Offline
    S Offline
    SysTech
    wrote on last edited by
    #1

    Hey all!

    I'm creating a display which can have widget within widget etc etc depending upon what the instrument returns.

    I have this mostly working. My structure is basically this:

    MainWidget - This creates a left widget area and right widget area with a splitter

    in the left area I have: graphHolderWidget. This just one big widget with a vertical layout

    As the instrument sends back various things I need to add new graphDisplayWidgets into the graphHolderWidget. Each graphDisplayWidget has a main area again with its own vertical box layout. In this I add a top graph, splitter, bottom graph. Then I add the whole display widget to the graphHolderWidget.

    This can repeat for up to 8 displays.

    The problem I'm having is on space that the layouts seem to be taking. If you example the picture at this link:

    https://dl.dropboxusercontent.com/u/7578983/LayoutDistance.png

    You can see what I'm asking about. On the left side of the screen is a light blue or cyan colored area. This is my graphHolderWidget that has the vertical layout in it. As you can see the vertical layout is smaller by a fair amount than the size of the graphHolderWidget.

    Drilling down further the green area (with a green and yellow parts inside) is a graphDisplayWidget. Again this has a vertical layout so the two parts of the graph, top (green) and bottom (yellow) can exist with a splitter in between. Again the vertical layout takes up a fair amount of margin space.

    Is there anyway to make the space between the widget and the vertical layouts smaller? I looked at the margin props of the layouts and they are all set to 0.

    What am I missing?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      The cyan border is the margin of the graphHolderWidget layout, so to remove it graphHolderWidget->layout()->setContentsMargins(0,0,0,0);.
      The green gap is the graphDisplayWidget layout's margin so to remove it graphDisplayWidget->layout()->setContentsMargins(0,0,0,0);.

      I'm not sure what zeros you got from the layouts. can you show the code you used for that?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SysTech
        wrote on last edited by
        #3

        Hi Chris,

        Thanks... I tried setting them in the property editor in Qt creator. That didn't work.

        I did try as you suggested setting them directly in the layout and got the results I desired.

        I think my first confusion was setting the wrong layout and getting myself confused on what it should do.

        Anyway I think this issue is solved.

        mark

        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