QScrollArea do not resize according to set size policy

43 Views Asked by At

I am not able to use the whole QDialog space for my QScrollArea. I set the QSizePolicy and setWidgetResizeable(true) , but with no results.

from PySide6 import QtWidgets, QtCore
from PySide6.QtCore import Qt
import sys

app = QtWidgets.QApplication(sys.argv)

dialog = QtWidgets.QDialog()

scrollArea = QtWidgets.QScrollArea()
scrollArea.setWidgetResizable(True)
scrollArea.setSizePolicy(QtWidgets.QSizePolicy.Policy.Maximum,QtWidgets.QSizePolicy.Policy.Maximum)

layout = QtWidgets.QVBoxLayout()
layout.addWidget(scrollArea, alignment=Qt.AlignCenter)

dialog.setLayout(layout)
dialog.show()

sys.exit(app.exec())

The QScrollArea do not want to resize to whole QDialog.

enter image description here

0

There are 0 best solutions below