Oct-24-2021, 02:16 PM
I cannot run your example (I have PySide2) and translating to PySide2 is difficult because of how you use the designer (which I hate hate hate hate designer code).
This is a short example of a working scrollable area.
Looking at your example I think the problem is that the scrolled widget is not larger than the scrollable area. I'm guessing that ui.scrollAreaWidgetContents is your scrolled widget (a QWidget?). I see where you place things in this widget but I don't see where the widget is resized. I would stop using setGeometry and use a layout manager instead. That will automatically grow the scrolled widget as needed.
This is a short example of a working scrollable area.
import sys import PySide2.QtWidgets as QtWidgets from PySide2.QtCore import Qt class MyWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.view = QtWidgets.QWidget() self.layout = QtWidgets.QVBoxLayout(self.view) self.scroll = QtWidgets.QScrollArea(self) self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.view) self.setCentralWidget(self.scroll) for i in range(20): self.layout.addWidget(QtWidgets.QLabel('Make this a fairly wide Label '+str(i))) app = QtWidgets.QApplication(sys.argv) ui = MyWindow() ui.show() sys.exit(app.exec_())The important parts are that the scrolled widget is larger than the scrollable area and that the scrollable area knows how big the scrolled widget is (setWidgetResizeable(True)).
Looking at your example I think the problem is that the scrolled widget is not larger than the scrollable area. I'm guessing that ui.scrollAreaWidgetContents is your scrolled widget (a QWidget?). I see where you place things in this widget but I don't see where the widget is resized. I would stop using setGeometry and use a layout manager instead. That will automatically grow the scrolled widget as needed.