I load different images at runtime into a QPixmap / QLabel. The pictures have different sizes, but the label width and height should not change (e.g. 500 x 400 px). The loaded pictures should scale into the QLabel size but keep the aspect ratio.
Following example does not work as expected:
self.systemPicture.setScaledContents(False)
self.systemPicture.setMaximumWidth(600)
pixmap = QPixmap('pictur.jpg')
pixmap.scaled(500, PyQt6.QtCore.Qt.AspectRatioMode.KeepAspectRatio)
self.systemPicture.setPixmap(pixmap)