Resizing Qt Widgets based on Window size

2019-08-04 04:41发布

I have certain Qt widgets inserted into QLayouts that are children of a Qt Window. I am trying to add a suggested size that the widgets need to be initialized with. I would also like Qt to resize the widgets proportional to what the Qt Window was resized. Additionally I would like to set an aspect ratio to the widgets that must be honored. However, the only way I can do so is using setFixedSize(). Though this widget cannot be rescaled with the window. Any suggestions??

EDIT: I tried inheriting QWidget and reimplementing heightForWidth(int w) function as described here (How to maintain widgets aspect ratio in Qt?)! . Did not have any luck with that. I am setting the layout within a QtScrollArea derived class.

0条回答
登录 后发表回答