Ivan Borshchov
Ivan Borshchov

Reputation: 3549

PySide in windows - remove padding from corners

For example if I add QStatusBar to my window, I see too wide corner:

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

enter image description here

Upvotes: 1

Views: 906

Answers (1)

bosnjak
bosnjak

Reputation: 8614

From the 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.)

So, basically:

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

Upvotes: 7

Related Questions