2 Attachment(s)
Adding a QListWidget messes up entire layout
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:
Attachment 12497
After ListWidget added:
Attachment 12498
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
Code:
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.playlist_List.sizePolicy().hasHeightForWidth())
self.playlist_List.setSizePolicy(sizePolicy)
self.playlist_List.setFocusPolicy(QtCore.Qt.ClickFocus)
self.playlist_List.setObjectName("playlist_List")
self.playlist_Layout.addWidget(self.playlist_List, 0, 0, 1, 1)
Then I create a new Layout, name it bottomLayout and adds that widget to it.
Code:
self.bottomLayout.setContentsMargins(0, 0, 0, 0)
self.bottomLayout.setSpacing(6)
self.bottomLayout.addLayout(self.playlist_Layout)
Note: This is the layout that gets added to bottomLayout
Code:
self.
playlist_Layout.
setSizeConstraint(QtWidgets.
QLayout.
SetDefaultConstraint) self.playlist_Layout.setContentsMargins(6, -1, 6, -1)
self.playlist_Layout.setSpacing(0)