@SGaist thank you, I took QFormLayout into account.
@VRonin also thank you!
I can not believe that it would take so much code to get this done...
After starting over and over again I came up with this:
GeneralTab::GeneralTab(QWidget *parent)
:QWidget(parent)
{
QLineEdit *lineEdit = new QLineEdit("/dev/video0");
QGroupBox *groupBox = new QGroupBox("Settings",this);
groupBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QFormLayout *formLayout = new QFormLayout(groupBox);
formLayout->addRow("Video Device: ",lineEdit);
}
and this looks exactly what I wanted, two widgets with a nice group box border sized to minimal space usage:
https://pauledd.files.wordpress.com/2016/08/pat4.png
I dont really know If this code is correct or might produce trouble but at least I dont find any errors at the moment.