Layout margins?
-
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?
-
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 itgraphDisplayWidget->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?
-
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