Resizing Qt Widgets based on Window size

不问归期 提交于 2019-12-11 04:18:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!