After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added:
border: 2px solid gray;
Specify a selector for the group box style such as:
QGroupBox { border: 2px solid gray; }
As for the gap, you can probably fix that by setting some padding. Check the docs here.