0
votes

I currently have the following structure in my form I have a QFrame (Brown) that has a QScrollArea . Now Multiple QFrames are dynamically added to the QScrollArea (gray).The dynamically added QFrame are composed of a QLabel.

enter image description here

Now here is the problem I have disabled the horizontal scrollbar in the QScrollArea . Thus the horizontal scrollbar does not show up. The problem is that when the dynamically added QFrame (gray) is added to the the QScrollArea. Half of the frame is cut off. This is because I have no way to scroll horizontally. What I want is to have the dynamically added Qframe expand vertically instead of horizontally. Any suggestions ?

Update : I have a QVBoxLayout inside the QScrollArea

1
How are you adding the inner frames? Do you have a layout inside of the QScrollArea? If not, consider adding it.SingerOfTheFall
Yes I have a QVBoxLayout inside the QScrollAreaRajeshwar
You should mess with the frames' size policies then. Try Fixed for horizontal size policy, and minimumExpanding for vertical, or something similarSingerOfTheFall

1 Answers

0
votes

Set the proper horizontal size policies for your dynamically created frames while creating them. One option is fixed size (QSizePolicy::Fixed), the other is QSizePolicy::Maximum (it's not very intuitive, but actually maximum means that the frame won't be bigger than the size specified by sizeHint() function). If you want the widget to expand vertically, set the vertical size policy to QSizePolicy::MinimumExpanding or QSizePolicy::Expanding - whatever works for you.