May-26-2023, 03:33 AM
This is a short example that demonstrates the problem.
import sys from PySide6.QtWidgets import QApplication, QVBoxLayout, QScrollArea, QWidget class CategoryWindow(QWidget): def __init__(self, parent=None): super().__init__(parent) layout = QVBoxLayout(self) scroll_area = QScrollArea() scroll_contents = QWidget(scroll_area) scroll_contents.setLayout(layout) scroll_area.setWidget(scroll_contents) layout.addWidget(scroll_area) if __name__ == "__main__": app = QApplication(sys.argv) window = CategoryWindow() window.show() sys.exit(app.exec())And here is the same code with a tiny change that results in the window being drawn.
import sys from PySide6.QtWidgets import QApplication, QVBoxLayout, QScrollArea, QWidget class CategoryWindow(QWidget): def __init__(self, parent=None): super().__init__(parent) layout = QVBoxLayout(self) scroll_area = QScrollArea() scroll_contents = QWidget(scroll_area) # scroll_contents.setLayout(layout) scroll_area.setWidget(scroll_contents) layout.addWidget(scroll_area) if __name__ == "__main__": app = QApplication(sys.argv) window = CategoryWindow() window.show() sys.exit(app.exec())