PDA

View Full Version : What to use QSpacerItem or layout's margin and spacing?



dpatel
10th June 2010, 11:33
Hi,

I am in a dilemma on what to use to add space between widgets in the layout. I am using QVBoxLayout and QHBoxLayout.
One option is to use QSpacerItem and call layout->addSpacerItem() and other option is to set the margins and spacing in layout. I can achieve my desired result by using both approaches.

Does Qt recommend to prefer one before another?

Thanks

CeeKey
10th June 2010, 16:21
Hey,

addSpacerItem() insert a space between two objects. spacing and margin add a space around all objects. have a look at this picture i uploaded for you:
http://img707.imageshack.us/img707/8715/marginspacing.png