Sumeet
Sumeet

Reputation: 8292

How to make QScrollArea change size according to QDialog?

I have a QDialog like this:

enter image description here

I have added a QScrollArea to this QDialog like this:

enter image description here

What I want is When the user expands QDialog , the QScrollArea should also expand with it.

I have tried several properties of QScrollArea like verticalScrollBarPolicy horizontalScrollBarPolicy, sizeAdjustPolicy, but nothing seems to work.

Can someone suggest how to accomplish this?

Upvotes: 1

Views: 360

Answers (1)

For the dialog to resize its child widgets, it must have a layout. Set a layout on the dialog. Do not change any of QScrollArea's properties: they only affect the area itself and its children, and have nothing to do with how the parent widget (the dialog) might manage the scroll area's geometry().

Upvotes: 1

Related Questions