I have a few widgets in a main window. i want the user to be able to resize the widgets inside the window as they please, just like how one would resize the main window. Do I have to make a layout container to enable this? or ....layout? Buh the layout contains are static once the window is rendered. In the picture the three widgets should be enable with resizing such that the user can drag their sides/corners to expand or minimize the widget size.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
One thing you could do is to use some QSplitter
's though it isn't directly as nuanced as you pointed out. Have a look at the image (you can drag the handles):
Another thing is to place the widgets using absolute coordinates and then detect when the cursor is clicked and dragged on the "edge". Then you calculate how much it should be resized and actually resize the widget according to its position.
You could also have a look at the QMdiArea
and then add your widgets using addSubWindow()
where you also set the window flags.