Qt-interest Archive, October 2007
Layouts and Margins
Message 1 in thread
Is there a way to globally set layouts to NOT have any margin padding?
I find it really tedious to have to call lyt->setContentsMargins( 0,
0, 0, 0 ) on every layout I ever use. It's also really hard to find
the offending layout if you forget. You also can't set the margins in
Designer. I was thinking of writing a recursive function that goes
through every layout of every widget and zeros the margins but that
seems ugly. Am I missing something? Why would I want to kill so much
space with un-necessary margins in nested layouts? I am relatively
new to layouts and they are great for re-sizing but they have caused
me great frustration. Any advice? Thanks...
-Willy
Qt 4.3.1
OS X
--
[ signature omitted ]
Message 2 in thread
On 24.10.07 19:18:38, Willy P wrote:
> Is there a way to globally set layouts to NOT have any margin padding?
> I find it really tedious to have to call lyt->setContentsMargins( 0,
> 0, 0, 0 ) on every layout I ever use. It's also really hard to find
> the offending layout if you forget. You also can't set the margins in
> Designer.
Huh? Works fine over here, though I can only select all margins at once
and not specify each side individually.
> I was thinking of writing a recursive function that goes
> through every layout of every widget and zeros the margins but that
> seems ugly. Am I missing something?
A recursive function that goes through your widget/layout hierarchy
and does something is not that ugly I think. After all thats why you
have such a hierarchy in the first place ;)
> Why would I want to kill so much
> space with un-necessary margins in nested layouts?
Why not, whitespace is not always bad. In fact a certain amount of
whitespace improves usability of your dialogs and widgets. Maybe you
don't have to nest your stuff that much, try to create a gridlayout that
manages your elements.
Andreas
--
[ signature omitted ]