I am currently working on a Qt project for my school. For this project I need to list an unknown number of elements in a window without resizing its content.
I’ve used some VBoxLayout in the past, but it isn’t what I am searching at all. This widget resizes its content depending on the number of elements it contains. What I would like is to add as much widgets as I need into the “scrolling widget”, which will stack next to each other automatically and won’t resize.
I tried using QScrollArea but I wasn’t able to make elements stack on each others.
Here is a small drawing explaining my problem:

If your display elements are simple, the easiest solution is a
QListWidget. This will automatically resize itself and inform theQScrollAreawhen you add items. You just have to callmyScrollAlrea -> setWidget (myListWidget)to initialise, and thenmyListWidget -> addItem (myListWidgetItem)to add new items.