QVBoxLayout:如何将小部件垂直对齐到顶部而不是中心 [英] QVBoxLayout: How to vertically align widgets to the top instead of the center

查看:964
本文介绍了QVBoxLayout:如何将小部件垂直对齐到顶部而不是中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Qt中,当我将小部件添加到布局中时,默认情况下它们垂直居中.有没有一种方法可以从顶部到底部列出"窗口小部件,而不是将它们垂直居中?

In Qt, When I add widgets to my layout, they are vertically centered by default. Is there a way to "List" the widgets from top to bottom instead of centering them vertically?

推荐答案

使用void QLayout::setAlignment ( Qt::Alignment alignment )方法根据您的选择设置对齐方式.

use void QLayout::setAlignment ( Qt::Alignment alignment ) method to set alignment according to your choice.

这篇关于QVBoxLayout:如何将小部件垂直对齐到顶部而不是中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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