5

I Added some QLabels with different colors to A QGridLayout as Layout of a QWidget, now I have a spacing between each Qlabel to the next and I want to remove it. I tried to set the margin of the Labels to "0" and the Alignment of the GridLayout to "0" but it didnt worked very good. i thought the space is maybe the border of the Labels but i checked. do you have any idea?

dadod2
  • 515
  • 1
  • 6
  • 11
  • Look at the docs for the layout itself. There's things with "spacing" in their name at the very top. – Mat May 05 '13 at 19:15

2 Answers2

3

Didnt belive i missed this :O thank yout Mat the solutions was:

layout->setHorizontalSpacing(0);
layout->setVerticalSpacing(0);

thanks

m7913d
  • 10,244
  • 7
  • 28
  • 56
dadod2
  • 515
  • 1
  • 6
  • 11
2

You can try setting the spacing:

layout->setSpacing(0);

If that doesn't do it, you can also try setting the contents margins to zero:

layout->setContentsMargins(0,0,0,0);

Garjy
  • 467
  • 5
  • 12