This is more of a conceptual question, so I don't have code to post yet. I am a little bit stuck on thinking of the right way to implement this idea, and I was wondering if anyone could offer an idea.

The Problem: I currently have a custom implementation of a linear layout, where widgets are being placed
from left to right horizontally. When row space runs out, they are moved down to the next row, like so:

1 2 3 4
5 6 7 8
9

The widgets that I am placing each belong to groups that can be arbitrarily long. I am currently trying to design a banner that would be place on top of these object, so if widgets 1,2,3 are in group A, and 4,5.6 are in group B there would be a banner over them like:

[ A ] [
1 2 3 4
B ]
5 6

I thought that QLabel would be the easiest way to do this, but if I run into the case where a group is split into the next row like above, I'm not sure how I can gracefully split the text inside of the label between rows :/. I was wondering if there was an easier way that I'm not thinking of or if I should just try to make this "split a QLabel's text into two different QLabels" idea work.

Cheers,
sp