View Full Version : Unwanted padding on QWidget

6th August 2008, 11:13
I'm trying to add a generic widget (to be used as a container for other widgets) to a dock widget, and there's some padding I can't seem to get rid of. Can I overwrite this somehow? I've tried using stylesheets but no luck.

In the attached image: said widget with orange background (for testing purposes) is sandwiched between two labels, with correct padding. Widget contains two other widgets in a couple layouts with default values.

6th August 2008, 12:08
Try setting margins for the layouts / widgets. :)

6th August 2008, 15:59
You mean as in style margins or something else? I've setStyleSheet("margin: 0; padding: 0;")'d all the elements involved, to no avail (not layouts since they can't carry style sheets, I think).

6th August 2008, 16:26
QLayout::setContentsMargins() (since Qt 4.3)

7th August 2008, 08:42
and it's not made its way into stylesheets yet eh?
thank you very much my good chap!