如何使用鼠标使用Qt更改网格布局单元的大小? [英] How to using mouse to change size of grid layout cells using Qt?

查看:960
本文介绍了如何使用鼠标使用Qt更改网格布局单元的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用网格布局(水平和垂直).我喜欢这样的事实,即调整窗口大小时会填满整个窗口内容.但是此扩展程序管理不善.我经常想更改网格布局中仅一列的大小,而不更改窗口的大小.例如在Windows资源管理器中.有两列-目录的左侧列表及其内容在左侧的右边.而且我总是可以在它们之间按下鼠标按钮,并拖动以更改列之间的相互大小.

I use grid layout (horizontal and vertical too). I like the fact that when resizing the window fills the entire window contents. but this extension is poorly managed. I often want to change the size of only one column in grid layout without changing the size of the window. such as in Windows Explorer. there are two columns - the left list of directories and their contents to the left to the right. and i can always press mouse button therebetween and pulling change the mutual sizes of columns in relation to each other.

如何在Qt中做到这一点?

how can I do this in Qt?

推荐答案

您需要使用 QGridLayout 情况(您只想将2个小部件一起显示). QSplitter可拖动.

You need to use a QSplitter rather than a QGridLayout in this specific case (where you just want 2 widgets shown together). QSplitters are draggable.

这篇关于如何使用鼠标使用Qt更改网格布局单元的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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