Overlapping layouts
-
Hi,
I initially designed my UI in Qt Creator without any layouts, but soon ran into some issues.
I then redesigned it using layouts, which worked for the most part even though it is a bit less flexible.
One thing that still bothers me is that I could nicely fit the tabs of my tab widget just below my file dialog to save some space.
However, now that everything is contained in layouts, this isn't possible anymore.
Is there anyway to make two layouts overlap somehow ?
I also tried to move the widget up at runtime, but for some reason I cannot access the absolute widget position displayed in Qt Creator.
Here's the picture, ideally I would like the top of the babs to be aligned with the top of the open file dialog.
Thanks !
-
@BGrimaud
Layouts (and possibly widgets) have margins (also spacing), if those are not empty (by default) that could cause extra spacing. In principle I would expect you be able to get things as close as possible if that is what you want.You cannot (so far as know) "overlap" layouts, not should you want to.
If you are running the PyQt/PySide
uic
on your.ui
files (as opposed toloadUi()
at runtime) that produces a.py
file from the.ui
file. There you can see the Python code generated from the.ui
. -
You also have to apply a layout to the whole outer widget. Otherwise you'll have free-floating layouts which is the same thing as before. Some goes for the individual tab pages. These also need a layout assigned (and not just a layout living inside of them). Assigning to tab pages is a little bit more complicated. You need to select each tab page after another and assign a layout to the tab widget (i.e. the widget the pages live in). This will assign the layout to the current page and not the tab widget. Trying to assign the layout to the page widget directly will fail.