主动调整主窗口内小部件的大小 [英] active resizing of widgets inside mainwindow

查看:62
本文介绍了主动调整主窗口内小部件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主窗口中有几个小部件.我希望用户能够随意调整窗口内小部件的大小,就像调整主窗口的大小一样.我是否必须制作布局容器才能启用此功能?或....布局?一旦窗口被渲染,布局包含是静态的.在图片中,三个小部件应启用调整大小,以便用户可以拖动它们的边/角来扩大或最小化小部件的大小.

解决方案

你可以做的一件事是使用一些 然后使用 addSubWindow()<添加小部件/a> 您还可以在其中设置窗口标志.

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.

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.

这篇关于主动调整主窗口内小部件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆