I'm not sure I clearly understood, but what about reducing the layout spacing and adding a spacer in the end :

after line 2 of the second code snippet :
Qt Code:
  1. layout->setSpacing(0)
To copy to clipboard, switch view to plain text mode 


after the loop where you fill layout with parameters :
Qt Code:
  1. layout->addSpacerItem( new QSpacerItem(50,15) ) ;
To copy to clipboard, switch view to plain text mode