PyQt(Python+Qt)学习随笔:布局控件layoutSpacing属性

在Qt Designer中布局控件有4个,分别是Vertical Layout(垂直布局)、Horizontal Layout(水平布局)、Grid Layout(网格布局)、Form Layout(表单布局),其中Vertical Layout(垂直布局)、Horizontal Layout(水平布局)这两个布局控件都有layoutSpacing这个属性,如图:
在这里插入图片描述
实际上布局控件对应的类QLayout并没有layoutSpacing这个属性,该属性实际上对应的是QLayout的spacing属性,用来指定布局控件内的部件之间的间距,这个间距对垂直布局部件来说就是子部件间垂直间距,对水平布局部件来说就是子部件间的水平间距。

该属性如果没有设置,则会从父布局部件中继承,或者从父部件的样式设置中继承。
该属性通过spacing() 、setSpacing(int)来访问和设置。


博客地址:https://blog.csdn.net/LaoYuanPython

老猿Python博客文章目录:https://blog.csdn.net/LaoYuanPython/article/details/98245036

原文地址:https://www.cnblogs.com/LaoYuanPython/p/11931637.html