mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-20 20:44:23 -04:00
Fix Downloads scroll area so internal widget is always the right size
This commit is contained in:
parent
b697e51d21
commit
05ec529d96
1 changed files with 15 additions and 3 deletions
|
@ -96,12 +96,24 @@ class DownloadList(QtWidgets.QScrollArea):
|
||||||
|
|
||||||
self.downloads = {}
|
self.downloads = {}
|
||||||
|
|
||||||
|
# The layout that holds all of the downloads
|
||||||
self.downloads_layout = QtWidgets.QVBoxLayout()
|
self.downloads_layout = QtWidgets.QVBoxLayout()
|
||||||
|
self.downloads_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.downloads_layout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
|
self.downloads_layout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
|
||||||
widget = QtWidgets.QWidget()
|
|
||||||
widget.setLayout(self.downloads_layout)
|
|
||||||
self.setWidget(widget)
|
|
||||||
|
|
||||||
|
# Wrapper layout that also contains a stretch
|
||||||
|
wrapper_layout = QtWidgets.QVBoxLayout()
|
||||||
|
wrapper_layout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
|
||||||
|
wrapper_layout.addLayout(self.downloads_layout)
|
||||||
|
wrapper_layout.addStretch()
|
||||||
|
|
||||||
|
# The internal widget of the scroll area
|
||||||
|
widget = QtWidgets.QWidget()
|
||||||
|
widget.setLayout(wrapper_layout)
|
||||||
|
self.setWidget(widget)
|
||||||
|
self.setWidgetResizable(True)
|
||||||
|
|
||||||
|
# Other scroll area settings
|
||||||
self.setBackgroundRole(QtGui.QPalette.Light)
|
self.setBackgroundRole(QtGui.QPalette.Light)
|
||||||
self.verticalScrollBar().rangeChanged.connect(self.resizeScroll)
|
self.verticalScrollBar().rangeChanged.connect(self.resizeScroll)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue