Project

General

Profile

"default" padding

Added by Peter Tagwercher almost 4 years ago

Hi everyone,

Just a hopefully very simple question:

If I open the browsers DevTools and check the layout then almost all div's (therefore probably WContainerWidgets) do have a padding of 6px by 9px (can be seen in element style).

How do I get rid of this padding all at once?

We are using the built in Bootstrap v3 theme.

Best Regards,

Peter


Replies (5)

RE: "default" padding - Added by Roel Standaert almost 4 years ago

I think if you're using layout managers, this is just the padding caused by the default contents margins and spacing.

You can just use WLayout::setContentsMargins(0, 0, 0, 0) and for WBoxLayout and WBorderLayout: setSpacing(0) to set it to 0.

RE: "default" padding - Added by Peter Tagwercher almost 4 years ago

>> I think if you're using layout managers, this is just the padding caused by the default contents margins and spacing.

I am using them all over the place, I am quite fine with them.

>> You can just use WLayout::setContentsMargins(0, 0, 0, 0) and for WBoxLayout and WBorderLayout: setSpacing(0) to set it to 0.

I will try that and give you an update. I think I was on the wrong path assuming that setPadding on the WContainerWidgets would do that for me.

RE: "default" padding - Added by Peter Tagwercher almost 4 years ago

It didn't work where I wanted it to happen but I was successful with setting a special style (setstyleclass).

Maybe it didn't work because I also wanted to do that to a WGridLayout?

But that adds a new question, how can I set a style on the element of a fieldset (WGroupBox)?

RE: "default" padding - Added by Peter Tagwercher almost 4 years ago

But, I have to add, at other areas where I use WContainerWidgets it works as expected.

RE: "default" padding - Added by Roel Standaert almost 4 years ago

I think for WGridLayout it's split up into setHorizontalSpacing() and setVerticalSpacing().

    (1-5/5)