Did you even read the example in QScrollArea docs? Do you see the differences between your code and the code of the example? Do you understand how QScrollArea works?