gpt4 book ai didi

python - Windows 中的 PySide - 从角落移除填充

转载 作者:可可西里 更新时间:2023-11-01 11:18:15 25 4
gpt4 key购买 nike

例如,如果我将 QStatusBar 添加到我的窗口,我会看到太宽的角:

self.stat = QtGui.QStatusBar()       
widLayout = QtGui.QVBoxLayout()
widLayout.addWidget(some_pannel)
widLayout.addWidget(self.stat)
self.setLayout(widLayout)

enter image description here

最佳答案

来自official documentation :

  • PySide.QtGui.QLayout.setContentsMargins() sets the width of the outer border on each side of the widget. This is the width of the reserved space along each of the PySide.QtGui.QBoxLayout ‘s four sides.
  • PySide.QtGui.QBoxLayout.setSpacing() sets the width between neighboring boxes. (You can use PySide.QtGui.QBoxLayout.addSpacing() to get more space at a particular spot.)

所以,基本上:

widLayout.setSpacing(0)
widLayout.setContentsMargins(0, 0, 0, 0)

关于python - Windows 中的 PySide - 从角落移除填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27504311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com