you can set the spacing and margin by hand after you called the setupUi function. to get the layouts you can use QObject::findChild().