How to create a scrollable QVBoxLayout?

It turned out that I was lead down a wrong path by putting the layout as the layout of a widget. The actual way to do this is as simple as:

scrollarea = QScrollArea(parent.widget())
layout = QVBoxLayout(scrollarea)
realmScroll.setWidget(layout.widget())

layout.addWidget(QLabel("Test"))

Which I’m pretty sure I tried originally, but hey it’s working.

However this adds an issue that the layout’s items are shrunk vertically instead of causing the scrollarea to add a scrollbar.

Leave a Comment