Qt-如何在QLayout中控制小部件的大小 [英] Qt - How to control the widget sizes in QLayout

查看:78
本文介绍了Qt-如何在QLayout中控制小部件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在布局中放置一些旋转框和线编辑.但是规模远远超出了必要性.下图是

I am trying to put some spinboxes,line edits in a layout. But the size extends more than the neccesity. Below is the figure

在这里,我要将QScrollArea小部件和QVBoxLayout添加到QHBoxLayout中.然后我添加行编辑,将框旋转到QVBoxLayout中.但我想将宽度减小为总宽度的2/10.有人可以帮我吗?

Here I am adding a QScrollArea widget,and a QVBoxLayout into a QHBoxLayout. Then I am adding the line edits,spin boxes into the QVBoxLayout. But I want to reduce the width as 2/10 of the total width. Can anybody help me in this?

推荐答案

很简单.可以通过给出拉伸因子来完成.这意味着在使用函数

It's easy. It can be done by giving the stretching factor. That means you have to initiate the value when you use the functions

addWidget(widget,stretchfactor);
       or
addLayout(layout,stretchfactor);

这篇关于Qt-如何在QLayout中控制小部件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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