I have a QListWidget inside a layout, and I have that ListWidget/Layout inside my main layout, and whenever i do ListWidget.Show the entire main layout get's messed up. It looks like it get's a bigger spacing or something, however I can't find out why it would do that. Anyone seen anything like it before?

Before ListWidget added:
3bf1d57ba270350613cb6e4bb17d6f61.png

After ListWidget added:
e4778e9d56601fb2dad3af044015953f.png


Code example if how listwidget is added (This is PyQt 5.8.2 in python 3.6)

First it's added thru the UI-Designer

Qt Code:
  1. self.playlist_List = QtWidgets.QListWidget(Form)
  2. sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
  3. sizePolicy.setHorizontalStretch(0)
  4. sizePolicy.setVerticalStretch(0)
  5. sizePolicy.setHeightForWidth(self.playlist_List.sizePolicy().hasHeightForWidth())
  6. self.playlist_List.setSizePolicy(sizePolicy)
  7. self.playlist_List.setFocusPolicy(QtCore.Qt.ClickFocus)
  8. self.playlist_List.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
  9. self.playlist_List.setObjectName("playlist_List")
  10. self.playlist_Layout.addWidget(self.playlist_List, 0, 0, 1, 1)
To copy to clipboard, switch view to plain text mode 

Then I create a new Layout, name it bottomLayout and adds that widget to it.

Qt Code:
  1. self.bottomLayout = QVBoxLayout()
  2. self.bottomLayout.setContentsMargins(0, 0, 0, 0)
  3. self.bottomLayout.setSpacing(6)
  4.  
  5. self.bottomLayout.addLayout(self.playlist_Layout)
To copy to clipboard, switch view to plain text mode 


Note: This is the layout that gets added to bottomLayout

Qt Code:
  1. self.playlist_Layout = QtWidgets.QGridLayout()
  2. self.playlist_Layout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
  3. self.playlist_Layout.setContentsMargins(6, -1, 6, -1)
  4. self.playlist_Layout.setSpacing(0)
To copy to clipboard, switch view to plain text mode