Issue
I am creating a simple plotting application using PySide and have a problem with loads of dead space.
How can I remove all this extra padding using stylesheets (preferably) or programmatically? I've tried setting margins and padding on QFrame to 0, but with little effect.
I'm using layouts for positioning and my widgets inherit from QFrame and generally contain other widgets such as QTabWidget, QListWidget etc..
(I have avoided the use of QWidget as I believe this is not fully supported by Qt Stylesheets)
Below is a screenshot of my app, with red lines pointing out my problematic dead space (The bottom red line is a bit too long - there is a statusbar)
Any ideas?
Solution
If you color the background of your widgets you see that no value for property margin
or padding
will change the spacing in between and the margin. This is controlled by the layout. Therefore in your layout set:
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
and all empty spaces should be gone. Unfortunately this can only be done programmatically and not by stylesheets. See also comments in Qt set contentsMargins from stylesheet and Qt remove margins
Answered By - Trilarion
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.