问题
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.
来源:https://stackoverflow.com/questions/17013984/resizing-qt-widgets-based-on-window-size