@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:
QLineEdit *lineEdit = new QLineEdit("/dev/video0");
QGroupBox *groupBox = new QGroupBox("Settings",this);
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.
I see you used a QVBoxLayout, but if I understand things correctly, it could've as well been a QHBoxLayout or QGridLayout because there's only one widget added?
Yes of course, you can use whatever layout suits your needs. Also there is no restriction that you have to put one single widget in it, it can as easily accomodate many child widgets. QMainWindow is bit different in that respect, as it doesn't have a layout itself, but instead relies on a central widget (the client area) to do the laying out. I hope that clears things. :)
Checkbox is a QAbstractButton child.
I think QButtonGroup is the one doing the real work of "exclusive" so I wonder if its possible to
create a child of QButtonGroup and teach it to handle new types.
But for QGroupBox, I did not trip over anything that suggest it can use another QButtonGroup. :(